Hai guys,
Please help me to sort out this issue. I wan to read from COM7 port. I tried every means to grab the values. What i am expecting from serial port is
"0A 0D AE E6 D6 6F D7 0F 0B 9B BF E2 41 A3 3A CF 67 CB D7 EE 6F 58 8B DB 7D 79 BE 6C 69 FE F3 B0 8D DD"
But i am getting the following value:
"x10 x13 x10 x13 x63 x63 x10 x13 x63 x63 x63 x111 x10 x13 x63 x63 x63 x111 x63 x15"
The code i am using is :
String Rxstring="";
char[] result = new char[1];
for (int len = 0; len < result.Length; )
len += serialPort1.Read(result, len, result.Length - len);
foreach (char c in result)
RxString += String.Format("x{0}", Convert.ToUInt16(c).ToString()) + " ";
I am writing 1 byte of data to COM port using a device(arduino uno). i changed the baud rate but no change in the data. is It the problem of conversion(Convert.ToUint16). Hot to convert it into HEX value.
Please help me guys.
additional information copied from non solution below (it came after solution 1)
Thanks my friend, I edited my code as you mentioned, again the problem exist. Now i am getting values as:
"0A 0D 3F 3F 3F 6F 3F 0F 1B 3F 3F 3F 41 3F 3A 3F 67 3F 3F 3F 6F 58 0B 3F 7D 79 3F 6C 69 3F 3F 3F 3F 3F"
Why i am getting "3F" most times and its ASCII equivalent is "?" ?.Some data matches exactly.But...
I am writing 1 byte of data to COM port using a device(arduino uno). I have changed the baud rate but no change in the data received . is It the problem of conversion(Convert.ToUint16) or does c# cannot recognize the character or problem with visual studio encoding.