Hi all,
I'm writing an app to communicate with a serial port device and I'm having trouble creating a proper byte value... I'm using the Rs232 class from gotdotnet, and did this:
Anyway, the problem is in "connection.write(&HD)". "write" is a method that sends a byte stream over the link. I've captured the streams with a serial port listener program, and what i got for the value "&HD" was this (in hex):
31 33
The rest of the characters were fine cuz it's how i wanted it to turn out. As you might notice, 31 and 33 are the ascii values for "1" and "3". But what I wanted to send was the HEX byte "0D" or "00001101" or "13". NOT ascii. I tried everything else like just putting "connection.write(13)" and used CByte and convert.toByte etc etc... nothing works... Please helppppppppp
Best regards,
Ron
I'm writing an app to communicate with a serial port device and I'm having trouble creating a proper byte value... I'm using the Rs232 class from gotdotnet, and did this:
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connection As New Rs232
connection.Open(7, 2400, 8, Rs232.DataParity.Parity_None, Rs232.DataStopBit.StopBit_1, 8)
connection.Write("U!SCVER?")
[color=Black] connection.Write(&HD)[/color]
connection.Read(3)
Dim temp As String
temp = connection.InputStreamString
TextBox1.Text = temp
connection.Close()
End Sub
Anyway, the problem is in "connection.write(&HD)". "write" is a method that sends a byte stream over the link. I've captured the streams with a serial port listener program, and what i got for the value "&HD" was this (in hex):
31 33
The rest of the characters were fine cuz it's how i wanted it to turn out. As you might notice, 31 and 33 are the ascii values for "1" and "3". But what I wanted to send was the HEX byte "0D" or "00001101" or "13". NOT ascii. I tried everything else like just putting "connection.write(13)" and used CByte and convert.toByte etc etc... nothing works... Please helppppppppp
Best regards,
Ron