RFID read write doc

Copyright © Parallax Inc. RFID Read/Write Module, Serial (#28440) v1.0 6/29/2010 Page 9 of 10
' ====================================================================================
'
' File...... rfid_rw_test.bs2
' Purpose... System-level test code for the Parallax RFID Read/Write Module
' Author.... Joe Grand, Grand Idea Studio, Inc. [www.grandideastudio.com]
' E-mail.... support@parallax.com
' Updated... 15 Dec 2009
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' ====================================================================================
' -----[ Program Description ]--------------------------------------------------------
'
' This program performs a system-level test of the Parallax RFID Read/
' Write Module by:
'
' 1) Reading tag's unique ID
' 2) Writing and verifying a block of data to the tag
' -----[ 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, BS2E, BS2PE
T9600 CON 84
#CASE BS2SX, BS2P
T9600 CON 240
#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_Password CON 0 ' Password (not readable)
ADDR_Protect CON 1 ' Protection Word
ADDR_Control CON 2 ' Control Word
' ADDR 3-31 are User EEPROM area
ADDR_Serial CON 32 ' Device Serial Number
ADDR_DeviceID CON 33 ' Device Identification