Shop OBEX P1 Docs P2 Docs Learn Events
Store ID tag numbers to one variable? — Parallax Forums

Store ID tag numbers to one variable?

Luis_PLuis_P Posts: 246
edited 2012-05-07 06:17 in BASIC Stamp
The project I'm working on reads the unique serial number on FOB KEY tag. The code use an array to SERIN one number at the time and DEBUG on screen . I need to combine all the numbers EX: 3501D5BDE2 and temporary store into one Variable. I want to do that so later in my code I can debug the names of ID holders, EX: IF 3501D5BDE2 THEN DEBUG "John Smith"

Main:
DEBUG "Ready..." ' Read unique ID from EM4102 read-only tag
Read_Legacy:
SEROUT RFID_TX, Baud, ["!RW", RFID_ReadLegacy]
SERIN RFID_RX, Baud, [STR buf\12] ' Get header and data

IF buf(0) <> $0A THEN Read_Legacy ' If we don't receive the correct header, keep trying until we do
FOR idx = 1 TO 10 ' Display the data (ignore final \r byte sent by the reader)
DEBUG buf(idx)
NEXT
DEBUG CR

DEBUG STR buf\12 '<= THIS DISPLAY ALL THE NUMBERS FROM THE ID TAG

PAUSE 1000
goto Main

Comments

  • Mike GMike G Posts: 2,702
    edited 2012-05-06 17:03
    Luis_P, the largest number the stamp can store is 65535 or 16-bit. It would be best to store the ID as an array of bytes and iterate over the byte array.
  • Luis_PLuis_P Posts: 246
    edited 2012-05-06 18:50
    How can I tell the stamp wich ID Tags are OK to open a door? In other words grant access to the ID tags I want.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-06 20:15
    Typically, you would use the READ / WRITE statements to store the byte arrays in part of the EEPROM used to hold the program. I believe there's a sample program showing this technique given as one of the examples for the RFID reader. You could also search this Stamp Forum for posted examples since this question has come up many times before.
  • Luis_PLuis_P Posts: 246
    edited 2012-05-06 21:16
    Mike Green wrote: »
    Typically, you would use the READ / WRITE statements to store the byte arrays in part of the EEPROM used to hold the program. I believe there's a sample program showing this technique given as one of the examples for the RFID reader. You could also search this Stamp Forum for posted examples since this question has come up many times before.

    Is possible to use RW tags and instead of a numbers store a name in the tag? so that way the tag reads a person name?
  • Mike GMike G Posts: 2,702
    edited 2012-05-07 06:17
    Is possible to use RW tags and instead of a numbers store a name in the tag? so that way the tag reads a person name?
    Yes and same byte array logic applies.
Sign In or Register to comment.