Reputation: 11
sprintf(SBuff,"Float value %0.4f ",temp_float);
USART0_TransmitString(SBuff);
I had also tried %f, and making the temp_float variable double (%lf).
But on Usart I always get Float value ? in place of the temp_float value I get question mark.
Upvotes: 0
Views: 1989
Reputation: 180947
AVR's sprintf()
doesn't by default implement floating point to save flash space, you need to change some compiler options to make that happen;
If the full functionality including the floating point conversions is required, the following options should be used:
-Wl,-u,vfprintf -lprintf_flt -lm
Full details can be found here.
Upvotes: 4