This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

about send data by serial port

How can I send float number(such 3.14 or2.36..etc.) to serial port?

can I define variable as float and send
such as..


float dat
void main()
dat = 3.14;
SBUF =dat;
...


  • floats are a 4-byte data object. If the receiver expects binary, send each of the float's 4 bytes. Otherwise, if the receiver expects ASCII characters (i.e., text), convert the float to a string (maybe using sprintf) and send all the characters in the string.