SerialPort1.Write(...) is not sending the right value...

dtvonly

Member
Joined
Jan 3, 2013
Messages
22
Programming Experience
5-10
Hi. I am using SerialPort1.Write(x) in VB.Net (express Visual Studio 2010) to send the value x to an MCU.
All "communication" are correct; i.e. RX and TX and interrupt from MCU are all working fine.

There is only one issue:

VB.NET:
dim value as integer
value = 45
SerialPort1.Write(value)

The MCU side is reading 52. What is wrong? Please advise.

p.s. I had also tried SerialPort1.Write(val(value)) but this does the same thing.
 
By using Write(String) method you're sending the String value "45". Ascii value of char "4" is decimal value 52.
 
Back
Top