Question Serial Port Truncating

computer guy

Member
Joined
Feb 12, 2008
Messages
18
Programming Experience
Beginner
I am using the .Net Com port control to send &HFF (255) to another device however it appears to be truncating it. At the other end I get &H35 (53).
If I send &H0 (0) At the other end I get &H30 (48).

Does anyone know what may be causing this. I have the following settings:

PortName = "Com4"
Parity = IO.Ports.Parity.None
Handshake = IO.Ports.Handshake.None
StopBits = IO.Ports.StopBits.One
DataBits = 8
BaudRate = 9600
WriteBufferSize = 2048
WriteTimeout = -1
ParityReplace = 63


Thank you :)
 
Last edited:
I sounds to me you are using Write(string), then know that default Encoding for SerialPort is ASCII, which goes to 127. Change Encoding.
 
I don't know what encoding your protocol requires, most encodings except ascii would have a character for that value. You could also send byte values if that is what your protocol expects. Use the programming documentation for your serial device.
 
You would then use the Write(buffer,offset,count) method.
 
Back
Top