RFID Reader Code Help
VultRad
Posts: 2
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.
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
Jeff T.
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.
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
#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