2017-02-27 05:07 AM
Hi all,
i am using GPS module in the project interfaced to the stm32f0 MCU. Everything working fine but how to send the float values of long&latt on the uart .
i tires replies in community but no luck. is there any setting needs to do in the compiler?
Compiler:Atollic truestudio.
Stm32cubeMx code generator.
2017-02-27 05:25 AM
There were some similar thread on how to put the right compile options to printf on the debugger SWO line some floating data recently.
Otherwise, in
there is an example of simple printf using bit fractional (for example 'printf('%M', 123456); which will output 3456 as easy to use string. More of a pseudo float without needing it and its library in the memory space.2017-02-27 09:55 AM
Any Uart sends or receives only bytes, that is 8bit integers. No floats. I would send something like X12.3456Y. So that the receiving SW can be absolutely sure where the number starts and ends.
To be exact: UARTS can send and receive something like 4-9bit integers but not all.
2017-02-27 10:08 AM
A 32-bit float is inadequate to represent latitude and longitude accurately/consistently.
Send them as a stream of bytes? The computer should have a common understanding of the IEEE formats used here. Presumably you want to send them in a compact machine readable fashion, not an ASCII human readable one?
Data representation in memory is a pretty basic tenet of computer science. You should review the representation of bytes, and words, and floating point numbers.