Reading the Serial Port

Onamission71

Member
Joined
Jul 8, 2009
Messages
14
Programming Experience
Beginner
Hi I'm working on a project involving reading RFID tags, I've written the code and it reads the tags ok by using the recieved data handler and displaying the result in a listbox, the only problem is that the data displayed has a couple of unreadable characters at the start (I'm using ReadLine() command.)
If I read the buffer byte by byte the data is all readable.
How can I read and display the whole 16 Bytes in one go??
 
Sorry here is my code:
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text Is "Read Tag" Then

SerialPort1.Open()

Button1.Text = "Stop Read"





ElseIf Button1.Text Is "Stop Read" Then

SerialPort1.Close()

Button1.Text = "Read Tag"



End If


End Sub



Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived


ListBox1.Items.Add(SerialPort1.ReadLine())
End Sub
End Class

I have one button to open/close the port and a list box to show received data.
 
Back
Top