Hi,
I know this issue is already discussed in another questions, but when I follow the steps to get float value I am unable to get that.
using KDS3.1.0 + PE
chip: KL03
there is nothing special in my code I am just writing
while(1)
{
PRINTF("\r\n %f",1.234);
OSA_TimeDelay(1000);
}
and it is giving me output as: f
I got two solutions after reading previous questions.
After adding this "PRINTF_FLOAT_ENABLE" symbol when I build my code, it is showing error as follows
It is printing the output as 'f' only.
I am also attaching here my project file,
why the float value is not getting printed?
Original Attachment has been moved to: float_30082016.zip
Solved! Go to Solution.
Hi Syed,
Attached is updated project that I got to work on my FRDM-KL03Z4 Freedom board to output floating point using printf as in your case #1 above.
I did have to change UART pinout to switch the RX/TX to make it work but I did not have the errors you indicate when I added the "PRINTF_FLOAT_ENABLE" to the Preprocessor Defined symbols. Note I used "" around the define. Your picture does not. My would compile fine without it but maybe it makes a difference on your system...
I did alter your code to have OS_Task Component so that more tasks could be added to the PE project. Just look for "//DES" to see where I made code changes.
My Terminal Output:
1.234000
1.234000
1.234000
1.234000
1.234000
1.234000
Regards,
David
PS
Please make sure your KDS has had updates applied.
Hi Syed,
Attached is updated project that I got to work on my FRDM-KL03Z4 Freedom board to output floating point using printf as in your case #1 above.
I did have to change UART pinout to switch the RX/TX to make it work but I did not have the errors you indicate when I added the "PRINTF_FLOAT_ENABLE" to the Preprocessor Defined symbols. Note I used "" around the define. Your picture does not. My would compile fine without it but maybe it makes a difference on your system...
I did alter your code to have OS_Task Component so that more tasks could be added to the PE project. Just look for "//DES" to see where I made code changes.
My Terminal Output:
1.234000
1.234000
1.234000
1.234000
1.234000
1.234000
Regards,
David
PS
Please make sure your KDS has had updates applied.
Thanks David,
you are correct I forgot to use Quotation marks " " while adding "PRINTF_FLOAT_ENABLE" to the Preprocessor Defined symbols.
Idris