Shop OBEX P1 Docs P2 Docs Learn Events
rfid code help — Parallax Forums

rfid code help

GiuseppeGiuseppe Posts: 51
edited 2009-03-05 05:48 in BASIC Stamp
Hello again, I am still trying figure out how to make my BS2 learn an rfid tag. Meaning I want to go into a program mode within my program and use the WRITE command to write the tag id in a variable that is in the eeprom. I did some research and I am coming to the conclusion that I cannot do that because I guess the BS2 does not have a scratch pad to save that big of a string of bytes into. It is becoming pretty confusing. I posted a thread similar to this and no one replied so I guess either my problem is very simple and on one cares to show this newbie or that no one has any idea what I am trying to do or what I am trying to achieve. Here is my code:

Program:
  LOW Enable

  SERIN RX, T2400, [noparse][[/noparse]WAIT($0A), STR datalog\10]             ' waits and reads tag


     FOR idx = 0 TO 9                                      ' writes to address of idx into that variable name
          WRITE idx, datalog
          DEBUG datalog(idx)                               ' displays each character on debug screen
     NEXT


  FREQOUT   Beep, 1000, 4500                               ' confirmation beep
  GOTO Reset                                               ' goes to actual program




This is the part of the code that I am trying to make that will read the tag and write it into the eeprom from addresses 0 to 9. Not sure if I did this right. Help here would be awesome.

Reset:
  LOW  Enable                                   ' activate the reader
  HIGH RedLED

Check_Tag:
     SERIN RX, T2400, [noparse][[/noparse]WAIT($0A), STR mysterytag\10]

     FOR idx = 0 TO 9

          DEBUG mysterytag(idx)

     NEXT

  FOR idx = 0 TO 9
    READ idx, datalog
    IF ( datalog <> mysterytag(idx) ) THEN
    GOTO Check_Tag
    ELSE
    ENDIF
  NEXT

  GOTO Tag_Found




This is the part that I am really iffy about. Basically its supposed to the code block that checks the written tag to the tag that was just presented. This code obviously does not work but like I said,, any help would be AWESOME.

Comments

  • BuddieBuddie Posts: 29
    edited 2009-03-05 02:18
    What is the datalog variable? Is it an array also? It seems as if you compare each portion of the mysterytag array to the same variable datalog. Maybe this is your problem.
  • GiuseppeGiuseppe Posts: 51
    edited 2009-03-05 05:48
    nevermind, i got it. thanks
Sign In or Register to comment.