How to truncate the buffer value from the function ftoa.

I am using the ftoa function to convert a floating point number to a character string to send out over the RS-232 link to a LCD display. The function returns an exponent of 10 to compansate for the string. However the string cannot be raised to a power because its a int, float etc. How would this be accomplished using this function. Is their a better way to perform this conversion?
I thought about using an array and converting each digit of the floating point number to a character.

Using:
DC 10.72
BL4S100
2x16 LCD display (NewHaven)

Bloat-city…but how about:

#undef STDIO_DISABLE_FLOATS

sprintf(buf,“%f”,float_number);

Then use appropriate modifiers.

Hello,

Use the below code, then send the each character from the buffer.

float myFloat = 3.23;
char myString[30];
sprintf(myString, “%f”, myFloat);

Thanks.

1 Like