How to print float value with printf in TrueStudio ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-06-24 10:11 PM
Hi All,
I'd like to print float value with printf.
when I tried, printf showed blank for float value.
would you please let me know how to set TrueStudio for printing float value with printf ?
I'm using STM32F103RF.
Thanks in advance.
#floatSolved! Go to Solution.
- Labels:
-
TrueSTUDIO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-08-01 12:45 AM
It seem to be a general problem with sprintf https://www.mikrocontroller.net/topic/359573
May be it is a problem with _sbrk in syscall.c
My solution:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-11-06 12:06 PM
in TrueSTUDIO:
Project -> C / C ++ Build -> Settings -> Tool settings -> C Linker -> Miscellaneous -> Other options:
- -u _printf_float
assuming newlib-nano as used by CubeMX.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-11-14 6:33 AM
Hi All,
I'm working with last atollic version 9.1.0 and I used your solution (@Hae Ryon Jung​) , and it doesn't work well.
I have a program to read, every second, ADC and converts counts to voltage, the source works well (the values are good) but the text in serial com only is printed well the first time, the others the dot "." is not printed..., I give you an example:
[0]ADC 2754 2.22 V
[1]ADC 2744 221 V
[2]ADC 2745 221 V
adcVal = HAL_ADC_GetValue(&hadc1);
adcRes = adcVal*3.3/4096;
sprintf(buffTmp, "[%d]ADC %d %4.2f V\n\r", (int) counter, (int)adcVal, adcRes);
Thanks for your support
Jordi

- « Previous
-
- 1
- 2
- Next »