This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hi,
If I use --printf_support=nofloat i'm not able to use float value. If I use minimal mode I'm not able to use unsigned integer. If I use full mode getting some memory usage error. But my requirement is to display float and unsigned interger using UART on Teraterm.
Thankyou
One fairly simple trick I've used is to scale the float into an integer, then split it into Left and Right of the decimal point for formatting. Schematically, something like:
int intval = floatval * 100; // Save two decimal places int intpart = intval / 100; // Integer part (left of decimal point) int decpart = intval % 100; // Decimal digits (right) sprintf(str,"%d.%02d", intpart, decpart); // Use snprintf(), not sprintf()
I can't find any of that code, but I seem to recall a few corner cases (-0, maybe?). That's the essence, anyway.
**Attention** This is a public forum