|
-
Oct 16th, 2006, 10:48 AM
#1
Thread Starter
Lively Member
[2005] Reading a RS232 port
I haven't received the kit yet, but am doing some pre-lim research. I will soon have an RFID reader/writer which has a RS232 interface. I will need in my VB app to read the data of the card when it is swiped via the reader.
Anyone know of any tutorials etc... for using a serial interface in VB 2005?
Thanks for any help
-
Oct 16th, 2006, 05:07 PM
#2
Sleep mode
Re: [2005] Reading a RS232 port
-
Oct 16th, 2006, 05:13 PM
#3
Re: [2005] Reading a RS232 port
 Originally Posted by jamesclarke112
I haven't received the kit yet, but am doing some pre-lim research. I will soon have an RFID reader/writer which has a RS232 interface. I will need in my VB app to read the data of the card when it is swiped via the reader.
Anyone know of any tutorials etc... for using a serial interface in VB 2005?
Thanks for any help
Hi,
You could try this link;
http://search.msdn.microsoft.com/sea...siteid=0&tab=0
Wkr,
sparrow1
-
Oct 16th, 2006, 05:16 PM
#4
Lively Member
Re: [2005] Reading a RS232 port
if you check this link there is a basic working example.
http://www.vbforums.com/showthread.php?t=402916
you can get a pretty good idea about how it all works & then check MSDN
for more detail. if you search "COM Port Sample" there is a project that you
can download. I have'nt tried it but MS samples are usually pretty good.
note that the Serialport.Readline method will read the input buffer until a
"Newline" is received. So it is necessary to find out what the terminating
characters are that will be sent by your connected equipment (usually
something like a carriage return). Then you can set the Newline property to
what is required. The default is CrLf (carrige return linefeed).
if you need to read the buffer one byte at a time you can use something like
this....
VB Code:
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
If SerialPort1.BytesToRead > 0 Then
Do
rxbyte.Add(SerialPort1.ReadByte)
TextBox1.Invoke(New myDelegate(AddressOf updateTextBox1), _
New Object() {})
Exit Do
Loop
End If
End Sub
hope this helps.
Microsoft Visual Basic 2008
-
Oct 17th, 2006, 02:23 AM
#5
Thread Starter
Lively Member
Re: [2005] Reading a RS232 port
Thanks for the pointers. Am I right in assuming that if I connect a USB device it will create a virtual com port if it doesn't create a new drive (e.g. like a digital camera would), and then I could use the same methods described above to read in the data?
Thanks
-
Oct 17th, 2006, 04:32 AM
#6
Hyperactive Member
Re: [2005] Reading a RS232 port
Yes,
You're right. But it's better if you test it with a real RS232 port, I experienced a lot of problems with USB to RS232 converters (to avoid headaches with correct code and non working hardware).
If you have no serial port on your laptop, you can use some PCMCIA to RS232 converters (QUATECH) had some god ones, that work without this problems.
-
Oct 17th, 2006, 06:38 AM
#7
Thread Starter
Lively Member
Re: [2005] Reading a RS232 port
The reason I asked about the USB is that I have been told that the reader is not RS232 but USB. I assume that the issue of converting is not a problem now and using the virtual com port is the only option?
-
Oct 17th, 2006, 06:43 AM
#8
Hyperactive Member
Re: [2005] Reading a RS232 port
normally these devices includes dll on an SDK (probably not .net dll). That gives you all functionality for the device.
-
Oct 17th, 2006, 11:28 AM
#9
Thread Starter
Lively Member
Re: [2005] Reading a RS232 port
All I got was the reader with a USB connection. I believe I can get hold of a dll for c++, but I take it that would be of no use in .NET
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|