RFID reader documentation
Parallax, Inc. • RFID Reader Module (#28140) •Updated 09/2005 v1.1 Page 10 
' -----[ Program Code ]---------------------------------------------------- 
Main: 
 LOW Enable ' activate the reader 
 #IF __No_SPRAM #THEN 
 SERIN RX, T2400, [WAIT($0A), STR buf\10] ' wait for hdr + ID 
 #ELSE 
 SERIN RX, T2400, [WAIT($0A), SPSTR 10] 
 #ENDIF 
 HIGH Enable ' 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 __No_SPRAM #THEN 
 IF (char <> buf(idx)) THEN Bad_Char ' compare tag to table 
 #ELSE 
 GET idx, chkChar ' read char from SPRAM 
 IF (char <> chkChar) THEN Bad_Char ' compare to table 
 #ENDIF 
 NEXT 
 GOTO Tag_Found ' all bytes match! 
Bad_Char: ' try next tag 
 NEXT 
Bad_Tag: 
 tagNum = 0 
 GOSUB Show_Name ' print message 
 FREQOUT Spkr, 1000 */ TmAdj, 115 */ FrAdj ' groan 
 PAUSE 1000 
 GOTO Main 
Tag_Found: 
 GOSUB Show_Name ' print name 
 HIGH Latch ' remove latch 
 FREQOUT Spkr, 2000 */ TmAdj, 880 */ FrAdj ' beep 
 LOW Latch ' restore latch 
 GOTO Main 
 END 
' -----[ Subroutines ]----------------------------------------------------- 
' Prints name associated with RFID tag 
Show_Name: 
 DEBUG DEC tagNum, ": " 
 LOOKUP tagNum, 
 [Name0, Name1, Name2, Name3], idx ' point to first character 
 DO 
 READ idx, char ' read character from name 
 IF (char = 0) THEN EXIT ' if 0, we're done 
 DEBUG char ' otherwise print it 
 idx = idx + 1 ' point to next character 
 LOOP 
 RETURN 










