Anybody have any experience with this function? I am trying to read data from a serial port with SerialPort.ReadExisting(). When I look at my port monitor tool I see the correct data. But when I read with the SerialPort function and convert the result into a byte array, it seems like half of my bytes are incorrect. Here is my code:
Code:Public Sub DataReceived( _ ByVal sender As Object, _ ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _ Handles m_oSerialPort.DataReceived Dim strResult As String Dim strHexString As String Dim baReturnPacket() As Byte strResult = m_oSerialPort.ReadExisting() Dim encoding As New System.Text.ASCIIEncoding() baReturnPacket = encoding.GetBytes(strResult)




Reply With Quote