Results 1 to 9 of 9

Thread: [2005] Reading a RS232 port

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Posts
    84

    [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

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: [2005] Reading a RS232 port

    check codeproject.com

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Reading a RS232 port

    Quote 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
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4
    Lively Member
    Join Date
    Apr 2006
    Location
    Local
    Posts
    112

    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:
    1. Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
    2.  
    3.            If SerialPort1.BytesToRead > 0 Then
    4.              Do
    5.                   rxbyte.Add(SerialPort1.ReadByte)                    
    6.                   TextBox1.Invoke(New myDelegate(AddressOf updateTextBox1), _
    7.                   New Object() {})
    8.                    Exit Do
    9.              Loop
    10.          End If
    11.  
    12.        End Sub

    hope this helps.
    Microsoft Visual Basic 2008

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Posts
    84

    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

  6. #6
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    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.
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Posts
    84

    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?

  8. #8
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    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.
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jul 2006
    Posts
    84

    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
  •  



Click Here to Expand Forum to Full Width