Page 1 of 1
RS232-dspMiac - Mifare Cards
Posted: Mon Dec 10, 2018 7:33 pm
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
Re: RS232-dspMiac - Mifare Cards
Posted: Tue Dec 11, 2018 8:48 am
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 ...
Hope that helps,
Leigh
Re: RS232-dspMiac - Mifare Cards
Posted: Tue Dec 11, 2018 9:12 am
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
Re: RS232-dspMiac - Mifare Cards
Posted: Wed Dec 12, 2018 12:51 pm
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
}
Re: RS232-dspMiac - Mifare Cards
Posted: Mon Dec 17, 2018 12:05 pm
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
Re: RS232-dspMiac - Mifare Cards
Posted: Mon Dec 17, 2018 12:27 pm
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.flowcode.co.uk/wiki/index.ph ... ateMachine