RFID Question

cbounds

New Member
I am new to PICAXE and learning so I am learning but I have a question:

I have my 08m hooked up to an ID-12 RFID reader and I am reading Parallax RFID cards. the code I am running to test is:

Pause 2000
SetFreq M8
SerTxd( "Starting", CR, LF )
Do
Serin 2, N9600_8, ( $02 ), b0, b1, b2, b3, b4, b5, b6, b7, b8, b9
SerTxd( "Tag = ", #b0, " ", #b1, " ", #b2, " ", #b3, " ", #b4, " " )
SerTxd( #b5, " ", #b6, " ", #b7, " ", #b8, " ", #b9, CR, LF )
Loop

The problem is that the cards numbers are showing in the terminal in this format:
Tag = 102 205 6 86 86 11 131 70 35 131

Shouldnt the cards show something like 046052C23F (numbers and letters) instead of this long sequence of numbers? What am I missing here? Thanks for any help......
 

cbounds

New Member
When I see others running this code with the ID-12 they are ot coverting anything? Not sure what I am doig wrong here.
 

KeithRB

Senior Member
One problem is that the ID-12 outputs in ASCII already, so you don't need the pound signs in the Sertxd command.
 

cbounds

New Member
This issue is still getting me and I have not yet found an answer. I have my ID-12 wired as follows:
'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 08m2
'Pin 9-TTL Data (Inverted)-Data 0-No Connection
'Pin 10- No connection
'Pin 11-Supply Voltage-+5v

Do I have something wired wrong or is it my code? Card are still read in this format in the terminal:
Tag = 102 205 6 86 86 11 131 70 35 131
instead of 046052C23F like I need them. Anyone have any ideas here????
 

cbounds

New Member
Yes I did. Thank You.... I removed the pound signs and the data was still displayed in the terminal the same way? Nothing else stands out?
 

AllyCat

Senior Member
Hi,

Indeed, what code are you now using, preferably within
Code:
 tags (# button)?  The code in post #1 certainly won't print out in Hexadecimal format.

But you appear to have a more fundamental problem, perhaps incorrect baud rate, polarity or synchronisation.  Your required "tag" contains three "odd" digits (5, 3 and either F or C) but your received code has five (205, 11, 131, 35 and 131).  Adding or subtracting 48 (or 55 for letters) to convert to/from ASCII isn't likely to fix that.

Cheers,  Alan.
 

KeithRB

Senior Member
The Data sheet says that the TTL output is inverted, but is silent on the CMOS output. You might need to change your N9600 to T9600
 

cbounds

New Member
Removed the pound signs and received garbled characters in the terminal. Switching to T9600 produced nothing in the terminal.
I tried this code and received garbled characters:
Pause 2000
SetFreq M4
SerTxd( "Starting", CR, LF )
Do
Serin 2, N9600_8, ( $02 ), b0, b1, b2, b3, b4, b5, b6, b7, b8, b9
SerTxd( "Tag = ", b0, " ", b1, " ", b2, " ", b3, " ", b4, " " )
SerTxd( b5, " ", b6, " ", b7, " ", b8, " ", b9, CR, LF )
Loop

Anyone have a different code to read RFID cards from ID-12 and picaxe?
 

KeithRB

Senior Member
Please don't ignore our advice, let us know that you at least tried it. Did you correct your Baud rate selector for the correct frequency you are running?
 

AllyCat

Senior Member
Do I have the ID-12 wired correctly to display serial data?
Hi,

I don't know how to tell since you haven't specified/linked the exact supplier/manufacturer of the device you're using, nor shown a circuit diagram or photo. I've never used one myself so can only look at a data sheet.

However using Setfreq M4 with N9600_8 is certainly incorrect. Since speed might be an issue you should perhaps try 16MHz and N9600_16. Have you tried the TTL output with both T and N format parameters?

If I were debugging it (and didn't have a 'scope), I would use #s in the sertxd command because they should at least give readable decimal numbers to examine and not just "garbled" characters. Also I would try removing the "qualifier" character in brackets (since that assumes you're receiving correct characters and it appears that you're not). Also frequently reset the PICaxe (to clear the data RAM to zeros) to ensure that the (same) data is actually being read and written by the PICaxe each time.

Cheers, Alan.
 

AllyCat

Senior Member
Hi Keith,

Yes I agree (once the correct characters are being received), but the OP appears not to be receiving the correct ASCII characters. IMHO for debugging we may get better "clues" from the decimal representations than from the display of non-printing or unrecognisable characters.

Cheers, Alan.
 

cbounds

New Member
I will try these things when I get home from work today... Thanks for all your help.
I was just hoping I didnt wire the ID-12 up wrong as the reader is wired for CMOS data (pin8 on ID-12) and not TTL.....
 

cbounds

New Member
Ok so I changed the code to:
Pause 2000
SetFreq M8
SerTxd( "Starting", CR, LF )
Do
Serin 2, N9600_8, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9
SerTxd( "Tag = ",b0, " ", b1, " ", b2, " ", b3, " ", b4, " " )
SerTxd( b5, " ", b6, " ", b7, " ", b8, " ", b9, CR, LF )
Loop

Cards are now reading like this in the terminal window:
Starting
Tag = ~5 0 0 0 8 F F 1 A
Another Tag read as:
Starting
Tag = ~5 0 0 0 8 F A C 7

I put the ~ symbol in there to represent the messed up character that is appearing
It looks closer to what the read should be but as you can see the first character is not right.
 

KeithRB

Senior Member
Put a "#" sign when you print b0 to see what character you are getting. But we are making progress!
ETA:
You left out the ($02), I would guess that that is the "messed up character"!
 

AllyCat

Senior Member
Hi,

Since you've removed the start/framing byte (which was in the brackets) the first byte is now that code (should be 02, which is not ASCII). So put a b10 at the start of the input string and (as Keith says) send it as #b10 .

But the string still bears no resemblence to what I thought you were expecting it to be (in the first post). :confused:

Cheers, Alan.
 

cbounds

New Member
BAM!!!!!

Changed the code to:
Pause 2000
SetFreq M8
SerTxd( "Starting", CR, LF )
Do
Serin 2, N9600_8, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9
SerTxd( "Tag = ",#b0, " ", b1, " ", b2, " ", b3, " ", b4, " " )
SerTxd( b5, " ", b6, " ", b7, " ", b8, " ", b9, CR, LF )
Loop

and got.......
Tag = 2 5 0 0 0 8 F A C 7


THANK YOU ALL so much for helping me. Im just starting Picaxe and getting my butt kicked but trying!!!!
 

KeithRB

Senior Member
There aren't too many greater joys in life than finally getting something like this working, congratulations!
 

AllyCat

Senior Member
Hi,

OK Keith, a fair point - a slip of my finger (I did refer to non-printing ASCII characters in an earlier post).

But the point is that the "Tag" above is not correct because the "2" is not part of the 10 character code.

And why is it now (apparently) working when the 02 should have been "found" by the Serin command previously, yet the data given in Post #1 bears no resemblence to the ASCII "Tag" now listed? :confused:

Cheers, Alan.
 
Top