SYMBOL tag3 = B3
SYMBOL tag4 = B4
SYMBOL tag5 = B5
SYMBOL tag6 = B6
SYMBOL tag7 = B7
SYMBOL tag8 = B8
SYMBOL tag9 = B9
SYMBOL tagNum = B10 ' from EEPROM table
SYMBOL pntr = B11 ' pointer to char in table
SYMBOL char = B12 ' character from table
' -----[ EEPROM Data ]-----------------------------------------------------
Tags:
EEPROM ("0F0184F20B") ' valid tags
EEPROM ("0F01D9D263")
EEPROM ("04129C1B43")
EEPROM ("0000000000") ' space for other tags
EEPROM ("0000000000")
' -----[ Initialization ]--------------------------------------------------
Reset:
HIGH Enable ' turn of RFID reader
LOW Latch ' lock the door!
' -----[ Program Code ]----------------------------------------------------
Main:
LOW Enable ' activate the reader
SERIN RX, T2400, ($0A) ' wait for header
SERIN RX, T2400, tag0, tag1, tag2, tag3, tag4 ' get tag bytes
SERIN RX, T2400, tag5, tag6, tag7, tag8, tag9
HIGH Enable ' deactivate reader
Check_List:
FOR tagNum = 0 TO LastTag ' scan through known tags
pntr = tagNum * 10 + 0 : READ pntr, char ' read char from DB
IF char <> tag0 THEN Bad_Char ' compare with tag data
pntr = tagNum * 10 + 1 : READ pntr, char
IF char <> tag1 THEN Bad_Char
pntr = tagNum * 10 + 2 : READ pntr, char
IF char <> tag2 THEN Bad_Char
pntr = tagNum * 10 + 3 : READ pntr, char
IF char <> tag3 THEN Bad_Char
pntr = tagNum * 10 + 4 : READ pntr, char
IF char <> tag4 THEN Bad_Char
pntr = tagNum * 10 + 5 : READ pntr, char
IF char <> tag5 THEN Bad_Char
pntr = tagNum * 10 + 6 : READ pntr, char
IF char <> tag6 THEN Bad_Char
pntr = tagNum * 10 + 7 : READ pntr, char
IF char <> tag7 THEN Bad_Char
pntr = tagNum * 10 + 8 : READ pntr, char
IF char <> tag8 THEN Bad_Char
pntr = tagNum * 10 + 9 : READ pntr, char
IF char <> tag9 THEN Bad_Char
GOTO Tag_Found ' all match -- good tag
Bad_Char:
Copyright © Parallax Inc. RFID Card Reader Serial & USB (#28140 / 28340) v2.3 10/9/2014 Page 7 of 11
NEXT
Bad_Tag:
SOUND Spkr, (25, 80) ' groan
PAUSE 1000
GOTO Main
Tag_Found:
DEBUG #tagNum, CR ' for testing
HIGH Latch ' remove latch
SOUND Spkr, (114, 165) ' beep
LOW Latch ' restore latch
GOTO Main
END
BASIC Stamp
®
2 Program
The following code examples read tags from a RFID Card Reader and compare the values to known tags
(stored in an EEPROM table).
' =========================================================================
'
' File....... RFID.BS2
' Purpose.... RFID Tag Reader / Simple Security System
' Author..... (c) Parallax, Inc. -- All Rights Reserved
' E-mail..... support@parallax.com
' Started....
' Updated.... 07 FEB 2005
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
'
' Reads tags from a Parallax RFID reader and compares to known tags (stored
' in EEPROM table). If tag is found, the program will disable a lock.
' -----[ Revision History ]------------------------------------------------
' -----[ I/O Definitions ]-------------------------------------------------
Enable PIN 0 ' low = reader on
RX PIN 1 ' serial from reader
Spkr PIN 2 ' speaker output
Latch PIN 3 ' lock/latch control
' -----[ Constants ]-------------------------------------------------------
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T4800 CON 188
T9600 CON 84
T19K2 CON 32
Copyright © Parallax Inc. RFID Card Reader Serial & USB (#28140 / 28340) v2.3 10/9/2014 Page 8 of 11
TMidi CON 12
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T4800 CON 500
T9600 CON 240
T19K2 CON 110
TMidi CON 60
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T4800 CON 813
T9600 CON 396
T19K2 CON 188
TMidi CON 108
T38K4 CON 84
#ENDSELECT
SevenBit CON $2000
Inverted CON $4000
Open CON $8000
Baud CON T2400
#SELECT $STAMP
#CASE BS2, BS2E
TmAdj CON $100 ' x 1.0 (time adjust)
FrAdj CON $100 ' x 1.0 (freq adjust)
#CASE BS2SX
TmAdj CON $280 ' x 2.5
FrAdj CON $066 ' x 0.4
#CASE BS2P
TmAdj CON $3C5 ' x 3.77
FrAdj CON $044 ' x 0.265
#CASE BS2PE
TmAdj CON $100 ' x 1.0
FrAdj CON $0AA ' x 0.665
#CASE BS2Px
TmAdj CON $607 ' x 6.03
FrAdj CON $2A ' x 0.166
#ENDSELECT
LastTag CON 3
#DEFINE __No_SPRAM = ($STAMP < BS2P) ' does module have SPRAM?
' -----[ Variables ]-------------------------------------------------------
#IF __No_SPRAM #THEN
buf VAR Byte(10) ' RFID bytes buffer
#ELSE
chkChar VAR Byte ' character to test
#ENDIF
tagNum VAR Nib ' from EEPROM table
idx VAR Byte ' tag byte index
char VAR Byte ' character from table
Copyright © Parallax Inc. RFID Card Reader Serial & USB (#28140 / 28340) v2.3 10/9/2014 Page 9 of 11

28340

Mfr. #:
Manufacturer:
Parallax
Description:
RFID Transponders RFID Reader USB
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet