security system using RFID
navychief
Posts: 40
I found the attached code from one of the forums and planning to apply it; however it won't activate the RFID to read tags. My tag serial number is 0133C2DD. Help please....
Comments
SERIN RX, T2400, [WAIT($0A), STR buf\10] ' wait for hdr + ID
There is something wrong there , the tag number should be a 10 character string.
Jeff T.
'
[ I/O Definitions ]
RFID_TX PIN 0 ' Connects to RFID R/W Module SIN
RFID_RX PIN 1 ' Connects to RFID R/W Module SOUT
'
[ Constants ]
#SELECT $STAMP
#CASE BS2
T9600 CON 84
#ENDSELECT
Baud CON T9600
' RFID R/W Module Commands
' Number of bytes returned in ()
RFID_Read CON $01 ' Read data from specified address, valid locations 1 to 33 (5)
RFID_Write CON $02 ' Write data to specified address, valid locations 3 to 31 (1)
RFID_Login CON $03 ' Login to tag with password (1)
RFID_SetPass CON $04 ' Change tag's password from old to new (1)
RFID_Protect CON $05 ' Enable/disable password protection (1)
RFID_Reset CON $06 ' Reset tag (1)
RFID_ReadLegacy CON $0F ' Read unique ID from EM4102 read-only tag (for backwards compatibility with Parallax RFID Card Reader, #28140 and #28340) (12)
' Memory map/address locations for EM4x50 tag
' Each address holds/returns a 32-bit (4 byte) value
' ADDR 3-31 are User EEPROM area
ADDR_Serial CON 32 ' Device Serial Number
ADDR_DeviceID CON 33 ' Device Identification
' Status/error return codes
ERR_OK CON $01 ' No errors
ERR_LIW CON $02 ' Did not find a listen window
ERR_NAK CON $03 ' Received a NAK, could be invalid command
ERR_NAK_OLDPW CON $04 ' Received a NAK sending old password (RFID_SetPass), could be incorrect password
ERR_NAK_NEWPW CON $05 ' Received a NAK sending new password (RFID_SetPass)
ERR_LIW_NEWPW CON $06 ' Did not find a listen window after sending old password (RFID_SetPass)
ERR_PARITY CON $07 ' Parity error when reading data
'
[ Variables ]
buf VAR BYTE(12) ' data buffer
idx VAR BYTE ' index
idy VAR BYTE
counter VAR WORD
'
[ EEPROM Data ]
'
[ Initialization ]
Initialize:
PAUSE 250 ' let DEBUG open
DEBUG CLS ' clear the screen
DEBUG "Parallax RFID Read/Write Module Test Application", CR,
"
", CR, CR
'
[ Program Code ]
Main:
DEBUG "Reading tag's unique serial number..."
Read_Tag:
SEROUT RFID_TX, Baud, ["!RW", RFID_Read, ADDR_Serial] ' Read tag's serial number
SERIN RFID_RX, Baud, [STR buf\5] ' Get status byte and data bytes
IF buf(0) <> ERR_OK THEN Read_Tag ' If we get an error, keep trying until the read is successful
FOR idx = 1 TO 4 ' Print data
DEBUG HEX2 buf(idx)
NEXT
DEBUG CR
Jeff T.
EDIT forget the above and excuse me for jumping to conclusions . The above deals with a different reader.
http://www.parallax.com/Portals/0/Downloads/docs/prod/rf/28440-RFID-RW-BS2code.zip
Parallax RFID Read/Write Module Test Application
Reading tag's unique serial number...01E762A1
In post #1 you stated, "My tag serial number is 0133C2DD" and the source app
bounced back that it's "01E782A1".
I bought a bunch of tags from Parallax, but there was no notation as to their #s,
so how do you know that yours is "...DD"?
PE -- Oh, and, yes
RFID_TX PIN 0 ' Connects to RFID R/W Module SIN
RFID_RX PIN 1 ' Connects to RFID R/W Module SOUT
That's where it's going to reprogram your tag to = $FEEDBEEF.
You have to be using a writable, R/W, RFID tag, a 'read-only' cannot be changed.
PE -- http://www.parallax.com/Store/Accessories/CommunicationRF/tabid/161/txtSearch/rfid/List/0/SortField/4/ProductID/689/Default.aspx
Please confirm that you definitely have an R/W tag.
You want to do another number or what?
Help me help you, Chief.
They have 5 bytes, but the R/Ws have 4 bytes.
I modified the prior program (attached.) It will look for $EF in buf(4).
If you didn't re-write your tag then change the test byte to look for $A1 (or whichever tag you're waving in front of it.)
Try this one (it should look for the hex $EF, not "EF")
Check:
IF buf(4) = "EF" THEN Unlock
DEBUG "Go Away!", CR
PE -- Please post a screen shot of your results. You're a nice guy, Chief, but I'm reluctant to open RTFs (etc.)