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

Problem with sprintf of float

Hi,
I have a strange problem with sprintf() function.
Sometimes when i declare new variable in my project (for example an U8) and I attempt to printf a previously declared float variable in a string a problem occurred.
My string contain lots of strange character but before new declaration no problem was occurred.

Variable is printed on this way:
printf((S8 *)(serial_string),%.1f\t",pos5v_measure);

my declaration:
U8 serial_string[0x400];
float pos5v_measure;

my settings:
pos5v_measure = config_buffer[n] (U8 var)

Otherwise if i use:
printf((S8 *)(serial_string),%d.%d\t",pos5v_measure/10,pos5v_measure%10);
problem is solved,it means that pos5v_measure contains the correct value.

But why??
Have any idea???

PS:My compiler is realview and my project is been converted from CARM to realview

Thank you, Manuel

0