I'm developing MODBUS slave device.
so I would like to send float value like 0.123.
I tried to send value to master by MODBUS example from IDF.
Is this right?
Whenever I send 0.xxx, master device read like 0.xxxxxx
Is there anyway that I send just 0.xxx
https://ibb.co/M6DtwwB
MODBUS question about sending value
-
- Posts: 211
- Joined: Fri Feb 01, 2019 4:02 pm
- Contact:
Re: MODBUS question about sending value
Hello, @chikichaka ,
Unfortunately, it is not possible to get exactly the same floating point value on these two different platforms.
The ModbusPoll is compiled on Windows and uses the Visual Studio floating point library. The ESP-Modbus uses the gcc compiler with its floating point library. The difference can be hidden in floating point library or in the printf() implementations of the used c libraries. The Windows one prints only 17 significant digits or so, and fills with zeros if more are requested. glibc's prints the correctly rounded value.
The result is the 4 byte IEE754 floating point value is represented differently on these two platforms.
Unfortunately, it is not possible to get exactly the same floating point value on these two different platforms.
The ModbusPoll is compiled on Windows and uses the Visual Studio floating point library. The ESP-Modbus uses the gcc compiler with its floating point library. The difference can be hidden in floating point library or in the printf() implementations of the used c libraries. The Windows one prints only 17 significant digits or so, and fills with zeros if more are requested. glibc's prints the correctly rounded value.
The result is the 4 byte IEE754 floating point value is represented differently on these two platforms.
Who is online
Users browsing this forum: benrank, Bing [Bot], MicroController and 92 guests