I am reading data from a scale using a serial port. Communication is working fine, but I’m getting garbage from the serial port.
An example:
???s.R?????0? ??o???????0? ??o???????0?
My problem is, I don’t know the behavior of the scale. I don’t know if its sending me hex, binary or what. And I don’t know what value its actually sending. I don’t have any documentation on the scale to research it.
So I guess, by default, what is normally sent back over the serial port and how do I convert it into a readable value?
That many question marks is a sign of having the SerialPort settings wrong. Starting with Baudrate, Parity is next.
If the scale sends binary data then the Encoding property matters. The default is ASCII so that generates a lot of question marks if the bytes in the binary data are >= 128. In which case you should use Read() instead of ReadLine(). Which is what you want to use to start to troubleshoot this problem, you want to look at the raw byte values, you can’t see much from question marks. Pay extra attention to the last one or two bytes you get from a reading, they should repeat well.