how to disp a float value on TFT screen with STM32F429ZI ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-03 2: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-03 2:17 AM
I solved now. this link is helpful.
https://ciastkolog.pl/elektronika/stm32truestudio-funkcje-printf-sprintf-a-zmienne-float-i-double/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-03 2: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/
