Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
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 3 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