I am trying to recieve HEX data from a seriall device.
Code is as below . but the required output is not correct. Some chracter code are not correct even in decimal . like for 80 i recieved 3F and for c0 also.
for example i recived a string .
10 02 3F 00 10 03 3F 61
but in actual data should be
10 02 80 00 10 03 c0 61
Public Sub DataSeriallReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived Dim buff As String Dim i As Short Dim c As Short Dim Response As String Dim part As String Response = "" Dim count As Integer count = SerialPort.BytesToRead Log(count.ToString, "recieved count", w) buff = SerialPort.ReadExisting For i = 1 To Len(buff) c = Asc(Mid(buff, i, 1)) Response = Response & Hex© Next i end sub
kindly anyone know what i am doing wrong.
waiting for positive replies.
Mod Edit: Please use code tags when posting your code. Code tags are used like so =>