Shop OBEX P1 Docs P2 Docs Learn Events
RFID Reader Code Help — Parallax Forums

RFID Reader Code Help

VultRadVultRad Posts: 2
edited 2011-01-26 09:28 in General Discussion
Hi everyone,

Not sure if this is the correct forum for this question or not but I am working on a car detector project. I am using Visual Basic 2008 to code the RFID Reader and so far it reads and displays the tag ID. I am trying to get it so that if this tag ID equals the tag ID then it is car #1. For example

If tag = "190037945C" then
textbox2.text = "car #1"
end if

When I try this nothing gets displayed in textbox2, so I am not sure if I am going about this the right way or not.

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-07-12 05:33
    Hi , look in the VB help files for String.Compare(string1,string2,True) or give a short example of what you have tried so far. Are you using Chris Savages RFID_Reader code.

    Jeff T.
  • VultRadVultRad Posts: 2
    edited 2009-07-12 05:52
    I figured it out after with the help of Chris Savages RFID code. This is what I came up with

    Public Sub RFIDReader()

    data = data + RFID.ReadExisting()
    If Len(data) = 12 Then
    TextBox1.Text = Microsoft.VisualBasic.Mid(data, 2, 10)
    RFID.DtrEnable = False
    EnableDTR.Enabled = False
    DisableDTR.Checked = True
    If TextBox1.Text = "190037945C" Then
    TextBox2.Text = "Car #1"
    ElseIf TextBox1.Text = "19003791E0" Then
    TextBox2.Text = "Car #2"
    End If

    I think it was before textbox1.text = textbox1.text + VisualBasic.Mid(data, 2, 11)
    The extra textbox1.text kept putting in the tag id in over and over so I think that is why it couldn't identify the tag.
  • tantan Posts: 1
    edited 2009-08-04 10:47
    Hello Friend,

    Could you please explain to me, how to get the Tag-id onto your program. How do you read the Tag-id so that you use it in your program

    Thanks & Regards,
    Tan
  • tmart2007tmart2007 Posts: 7
    edited 2011-01-26 09:28
    #1) I use the parallax basic stamp module to read the RFID - no components required -- just connect to power on Basic Stamp Board, and pin 0 to enable and pin 1 to sout

    #2) It takes very little Basic stamp code to read the RFID card

    #3) The read in is then "echoed" by the basic stamp through and to the rs232 port of the Basic stamp through a debug statement.

    #4) VB then read that info into the VB 5 program.

    all code can be provided for the Basic Stamp and VB 5
    tmart2007@GMail.com - ted
    ====
    what is interesting is that you can send code with the debug statement that tells it whether it is door A or B
    for instance:



    Enable pin 0
    RX pin 1
    RT pin 2

    sData Var Byte

    T9600 Con 396

    '
    # SELECT $STAMP
    #CASE BS2, BS2E, BS2PE
    T2400 CON 396
    #CASE BS2SX, BS2P
    T2400 CON 1021
    #CASE BS2PX
    T9600 CON 396
    #ENDSELECT



    buf Var Byte(10) 'reading ten digits
    tagNum var Nib
    idx Var Byte

    '
    Reset:
    HIGH Enable


    Main:
    LOW Enable
    Serin RX T2400, [WAIT($0A), STR buf\10]
    HIGH Enable

    Display _Tag:

    DEBUG "Door A", CR

    For idx=0 to 9
    DEBUG buf(idx)
    Next

    DEBUG CR

    PAUSE 500

    GOTO Main


    =========

    this code sends the tag info read to the buffer and will put it on the screen of the Basic Stamp program

    ====
    Just need to parse it in VB and take out what you want and the 10 digits or part of the 10 digits
    I only use the last three digits of the RFID tag with about 700 tags

    ====

    I then use a VB routine in the visual basic program to set off a relay for door A or B. The relay is set off through the parallel port to an 8 relay board controlled by the parallel port. A or B is parsed out to tell me which door to set off the relay for.

    thanks
    ted
Sign In or Register to comment.