2018-09-03 12:38 AM
Hello everyone, I try to disp float value on TFT Screen with STM32F429ZI. But, sprintf function is not work. Can you help me ? please.
float fff = 0.85;
char s_TextMsg[20];
sprintf(s_TextMsg,"%.2f",fff);
snprintf(s_TextMsg,20,"%.2f",fff);
GUI_DispStringAt(s_TextMsg,110,140);
2018-09-03 02:13 AM
You left important details out.
What IDE/libraries you use in your project ?
Many toolchains set size-reduced libs as default, which do not contain code for floating point support in scanf/printf functions (beside others).
BTW:
[quote]float fff = 0.85;[/quote]
You do not assign a float value here.
2018-09-03 02:17 AM
I solved now. this link is helpful.
https://ciastkolog.pl/elektronika/stm32truestudio-funkcje-printf-sprintf-a-zmienne-float-i-double/
2018-09-03 02:18 AM
Thank you for answered I use TrueStudio for IDE. this link solved my problem.
https://ciastkolog.pl/elektronika/stm32truestudio-funkcje-printf-sprintf-a-zmienne-float-i-double/