RFID Code using ID-12 RFID Reader

Burnie

New Member
Hi,

I purchased an ID-12 RFID reader from SparkFun Electronics and spent several days trying to put together a working program. The documentation from both the manufacturer, store and what I could find online was conflicting at best. Below you will find a basic working program with connection information.

Special thanks to this forum for leading me in the right direction.

'==========================================================
'RFID Reader using ID-12 by ID-innovations and Picaxe 18X
'Jan 13th, 2008

'Pin 1-Supply Voltage-GND
'Pin 2-Reset-+5V
'Pin 3-ANT-No Connection
'Pin 4-ANT-No Connection
'Pin 5-Card Present-No Connection
'Pin 6-Future-No Connection
'Pin 7-Format Selector-GND
'Pin 8-CMOS-Data 1-To Input 2 of Picaxe 18X
'Pin 9-TTL Data (Inverted)-Data 0-No Connection
'Pin 10-Beeper/LED-Connect to Anode of LED through 1K resistor
'Pin 11-Supply Voltage-+5v
'
'Numbers listed in EEprom data are for the cards I used, yours will be different

' -----[ EEPROM Data ]-----------------------------------------------------
eeprom 0, ("0415D74A8A")' Tag 2
eeprom 10,("0415DA2B6B")' Tag 3
eeprom 20,("04604E317F")' Tag Watch
eeprom 30,("0415D76818")' Tag 4
eeprom 40,("0415EA0DD2")' Tag 5
eeprom 50,("046052C23F")' Tag 1
' -----[ Constants ]-------------------------------------------------------
SYMBOL LastTag = 6 ' 6 tags; 0 to 5
' -----[ Variables ]-------------------------------------------------------
SYMBOL tag0 = B0 ' RFID bytes buffer
SYMBOL tag1 = B1
SYMBOL tag2 = B2
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
'==================================
CheckReader:

setfreq m8 ' set to 8mhz
' Note: n9600 = n4800 @ 8mhz
serin 2,n4800, ($02),B0,b1,b2,b3,b4,b5,b6,b7,b8,b9

setfreq m4 ' reset to 4mhz to allow for onscreen debug
debug b0 'Use on-screen debug to determine Card Numbers

let pins = %00000000 'Set all output pins low

Check_List:

FOR tagNum = 0 TO LastTag ' scan through known tags saved in EEPROM
debug b0 'Use on-screen debug to determine Card Numbers
pntr = tagNum * 10 + 0 : READ pntr, char ' Read char from EEPROM
IF char <> tag0 THEN Bad_Char ' Compare tag data with char from EEPROM one at a time
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 characters matched EEPROM Data, valid tag found

Bad_Char:
NEXT

Bad_Tag:
GOTO CheckReader

Tag_Found:

'These are simple if-then commands to action when a valid card is found

if tagNum=0 then
high 0
end if

if tagNum=1 then
high 1
end if

if tagNum=2 then
high 2
end if

if tagNum=3 then
high 3
end if

if tagNum=4 then
high 4
end if

if tagNum=5 then
high 5
end if

goto CheckReader
'==========================================================
 

hippy

Ex-Staff (retired)
setfreq m8 ' set to 8mhz
' Note: n9600 = n4800 @ 8mhz
serin 2,n4800, ($02),B0,b1,b2,b3,b4,b5,b6,b7,b8,b9
setfreq m4 ' reset to 4mhz to allow for onscreen debug
debug b0 'Use on-screen debug to determine Card Numbers
 

Falcon_007

New Member
setfreq m8 ' set to 8mhz
' Note: n9600 = n4800 @ 8mhz
serin 2,n4800, ($02),B0,b1,b2,b3,b4,b5,b6,b7,b8,b9
setfreq m4 ' reset to 4mhz to allow for onscreen debug
debug b0 'Use on-screen debug to determine Card Numbers

RFID:
serfreq m8
serin 0,N4800,($02),b0,b1,b2,b3,b4,b5,b6,b7,b8,b9
serfreq m4
debug b0
pause 2000
goto RFID



i tried this simple program......:( didnt work
when i debug it.....takes alot of time debug(waiting)
 
Top