RS232-dspMiac - Mifare Cards

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
gavo4
Posts: 92
Joined: Sat Aug 25, 2018 7:58 pm
Been thanked: 8 times
Contact:

RS232-dspMiac - Mifare Cards

Post by gavo4 »

Hi All,

I am new to Flowcode and need to some help on a Mifare RF ID card. I have the RS232 routine working and I am able to read the serial number with no issues. Only problem is I am battling to "find" the number "3" in the routine. The serial number is 8 characters long and all I want to do is identify the number 3. I have tried various way and nothing seems to work, please see code attached.

Any help would be greatly appreciated

Regards,

Gavin
Attachments
TAG+Reader.fcfx
(12.51 KiB) Downloaded 235 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: RS232-dspMiac - Mifare Cards

Post by LeighM »

Hi Gavin,
You likely want to test for the (ASCII) character '3', which is identified by '3' not 3
Also you are requesting 9 characters, so their index in the string will be from B0[0] to B0[8]
So if you are testing the last, 9th character, your test needs to be ...

Code: Select all

B0[8] = '3'
Hope that helps,
Leigh

gavo4
Posts: 92
Joined: Sat Aug 25, 2018 7:58 pm
Been thanked: 8 times
Contact:

Re: RS232-dspMiac - Mifare Cards

Post by gavo4 »

Hi Leigh,

Thanks for the reply, got the ASCII '3' as I was using "3", also the 3 can appear anywhere in the string from 1-8, so I assume I need a decision for each B0[0], B[1], B0[2] etc?

Regards,

Gavin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RS232-dspMiac - Mifare Cards

Post by Benj »

Hi Gavin,

Sounds like a job for a loop.

Code: Select all

found = 0
idx = 0

while ( (idx < 9) && (found = 0) )
{
	if (B0[idx] = '3')
	{
		found = 1
	}
	idx = idx + 1
}

gavo4
Posts: 92
Joined: Sat Aug 25, 2018 7:58 pm
Been thanked: 8 times
Contact:

Re: RS232-dspMiac - Mifare Cards

Post by gavo4 »

Hi Benj and Leigh,

I have the routine working on the code attached, my problem is if I use anything less than 200mS Timeout I don't see any data displayed, I have allot of "other" things happening in the background and anything more than 100mS will kill what i am trying to achieve

When I tried the same Hardware using PBP3 it works rights down to 10mS and in a terminal program the data run like crazy in the terminal program so I can't understand why I cannot see it, any ideas?....;-)

Regards,

Gavin
Attachments
TAG+Reader.fcfx
(19.51 KiB) Downloaded 243 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RS232-dspMiac - Mifare Cards

Post by Benj »

Hi Gavin,

You have the UART initialise macro call located within the loop which may be causing the problems your experiencing. Try moving the initialise call so that it is called once before the loop and hopefully this will help.

You might also want to use a state machine approach as this should allow you to have more reliable comms.
https://www.matrixtsl.com/wiki/index.ph ... ateMachine

Post Reply