hi guys.. i need to read tags using rfid reader. the reader is connected to the computer using serial port. can anyone advise me the codes for receving the tags data? i'm using microsoft visual studio 2005.
thanks. your help is appreciated.:(

Recommended Answers

All 2 Replies

wow...this is kind of up my alley here.

Ok first, you need to read up on the protocol for reading/writing to and from the read/writer and create code that will assemble protocol-structured statements and pipe them out over the serial port.

Once you've got that done its really simple. In VB2005 or greater you could start with this:

Imports System.IO
Imports System.IO.Ports
Imports System.IO.Ports.SerialPort

Public Class Form1

Dim sp as new serialport

private sub form1_load(blah blah)
sp.close() 'you always want to close the port when closing the form or opening just incase it was left open
sp.baudrate = 9600
sp.open()
end sub

sub write(byval str as string) ' this is where you're going to send 
'the string you've assembled, or you could even use a byte or 
'char array and really have it work beautifully...
'depends how proficient you are with VB and/or code

dim sw as new stopwatch

try
sw.start()
sp.write(str)
do until sp.bytestoread = <whatever> or sw.elapsedmilliseconds > 1000
system.threading.thread.sleep(1)
loop
dim intnumbytes as integer = sp.bytestoread
dim bytchardata(intnumbytes -1) as byte
sp.read(bytchardata, 0, intnumbytes)
sw.stop()
sw.reset()
catch ex as exception
messagebox.show(ex.tostring)
end try
end sub
end class

Try that out let us know how it works. Good luck.

Does it work regardless of the rfid brand?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.