Today is...
Monday, September 16, 2019
Welcome to, the global online
community of automation professionals.
Featured Video...
Featured Video
A demonstration of EtherCAT control of linear motors using the CTC EtherCAT master.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive
Floating point in little endian can be read in big endian but value not same.
Reading IEEE little endian format data

We have observed that if Modbus data is in IEEE floating format in Little endian then it can be read in Big Endian Floating format but 1 register higher and data value is not the same all time. If floating data is in Bigendain then that data can not be read in Little ednian format. So is this issue with little endian? Many time Modbus vendor does not give full information about floating data format like big endian or little endia that we have to try and use the appropriate format. But little endian format creates confusion as we can read in big-endian and little-edniadn both. If some one has some solution or tips as how to check the floating point data as in which format will be of great help.

This is not unique to big/little endian.

They are called "Floating Point" because the point floats around and even within a single chip it can be different over time.

Are here any values in the system that are in a known range? I'm thinking something like base pressures and temperatures for a flow meter, for example. You know the temperature will be 0 degC or 15 degC or 15 degF so try the options till you get the expected value.

By Helmut Ritter on 8 May, 2014 - 12:01 pm

Modbus only defines values up to 16 bit (size of a register or holding register). As soon as you need to transfer larger data types (integer 32, float, double) it is necessary to use several registers. Now you have the situation that this is not covered by the specification, so it is manufacturer dependent. Limiting a data range does not help you at all - the situation is that the high-word and the low-word (upper and lower 16 bit) of your 32 bit float value are swapped. If the bit stream is still a valid float number, you can see a value which is potentially wrong. But it can also deliver a "NaN" - not a number. For instance, the bit stream 0x00000001 is valid as Integer = 1, but it is NaN as float. If you have a word swap on the integer value, you will get 0x00010000 - which is of course completely wrong, but a valid number.

Conclusion: You can only solve the problem if you bring both, master and slave, to the same interpretation of the two registers used for the float. The bachmann M1 controller offers a configuration flag for each data point.