I’m writing software to communicate with the WattNode. How do I interpret the float registers? An IEEE-754 single-precision (32-bit) float converter can help. Here are links to a couple of converters:

If you enter a value of “1.005” in the “Decimal Floating-Point” field and click the “Not Rounded” button then you should see the equivalent 4-byte hexadecimal representation below:

3F 80 A3 D7

Note that the 4 bytes shown are in big-endian order (i.e. the most significant byte first; the least significant byte last) because that is the most intuitive way for humans to think about it. However, the byte order that you would read the same value back from a WattNode float register would be:

A3 D7 3F 80

That’s because the 16-bit register bytes are in big-endian order but the relative word order for the two consecutive registers that comprise the 32-bit float value is in little-endian order. Also note that the order that the bytes are stored in the memory of an Intel x86 machine (i.e. as in most desktop computers) are:

D7 A3 80 3F

In this case all 4 bytes are in strict, little-endian order (i.e. the least significant byte first; the most significant byte last). So your program has to rearrange the bytes that were received from the WattNode into the order that your CPU expects before it can correctly interpret the data as a decimal value of 1.005. The C-language code example in Common Modbus Protocol Misconceptions shows one way of doing this. It’s confusing, but that’s how the standards evolved over the last 30 years. Remember, when the Modbus communications protocol was invented, the IEEE-754 standard did not exist yet and most CPUs were big-endian whereas today, most are little-endian.

Keywords: hex, float, binary