I am trying to make an RFID reader using Parallax's RFID Reader Module and a PIC 16F628A.
I am using PBP and am having troubles figuring out how to convert over the sample code found at Parallax to work in PBP.
Sample code: http://www.parallax.com/dl/src/prod/RFID1.BS2
The main trouble I am having is getting the comparison to work. I'm not sure what the best way would be to compare the scanned RFID 10 byte string array against a set of known tags.
Below is the part of the code I believe is not working right.
Does anybody have any idea on what I can do to fix this or perhaps someone has a better way of doing it? Thanks in advance!
-Dan
' -----[ EEPROM Data ]-----------------------------------------------------
Tag1 DATA "100050D77C" ' valid tags
Tag2 DATA "1000504B02"
Tag3 DATA "1000502DC9"
Tag4 DATA "100050803A"
Tag5 DATA "100050C472"
' -----[ Program Code ]----------------------------------------------------
Main:
LOW portb.3 ' activate the reader
SERIN2 portb.2, T2400, [WAIT($0A), STR buf\10] ' wait for hdr + ID
HIGH portb.3 ' deactivate reader
Check_List:
FOR tagNum = 1 TO LastTag ' scan through known tags
FOR idx = 0 TO 9 ' scan bytes in tag
READ (tagNum - 1 * 10 + idx), char ' get tag data from table
IF (char <> buf(idx)) THEN Bad_Char ' compare tag to table
NEXT
GOTO Tag_Found ' all bytes match!
Bad_Char: ' try next tag
NEXT
Bookmarks