N and V column
Column #120: You Can’t Touch That: Non-contact Access Control
Page 84 • The Nuts and Volts of BASIC Stamps (Volume 6)
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