We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I need help to convert a floating point to ascii format. I found the command atof() that converts ascii to float, but what about the other way round? Is there any command in C51 that does this? And I want to send the result to PC without using the printf function because it uses a lot of space. How can I do this? Any code examples would help.
Check if your STDLIB.H contains the prototype of strtod. I use C166, but maybe it doesn't differ from C51 in this respect. Obviously, printf uses strtod to perform conversions, but C166 library reference does not mention it. - Mike
My mistake, it's the other way around :-( Seems like the code that converts float to string can't be separated from printf. You have to write it yourself. By the way, if you only need to send the float to PC, you don't have to convert it to string. You can send the four bytes in hexadecimal, the conversion can be done in the PC. - Mike
"without using the printf function because it uses a lot of space" How does it compare to using floating point!?