Learn MoreFAQsTutorials

2 posts / 0 new
Last post
Jasu
Offline
Last seen:1 year 10 months ago
加入:2019-01-23 10:26
floating point

i want to print floating point number in uart ,is it possible?then how?

Keywords:
Device:
PM_Dialog
Online
Last seen:1 min 20 sec ago
工作人员
加入:2018-02-08 11:03
嗨Jasu,

嗨Jasu,

We don’t have any API for printing floating point values. A quick solution to this could be to divide and modulo the value by precision (for example 10) that you would like in order to find the integer part of the floating point value, subtract the integer value from the original value so that you have only the decimal numbers and then multiply the floating point values with multiples of the precision (for example 10)depending on the decimal numbers of accuracy that you would like to have and then print both results as integers. After that, you can use the arch_printf() for printing.

Thanks, PM_Dialog