4 Modbus protocol description
24
4.7 Transmission format (integer, float, double and text values)
Integer values Integer values are transmitted via the Modbus in the following format:
The high byte first, followed by the low byte.
Example Request of the integer value of address 0x1017, if value "4" (word value
0x0004) is written under this address.
Request: 01031017000130CE (CRC16 = CE30)
Response: 0103020004B987 (CRC16 = 87B9)
Float values In the case of float values, the Modbus operates with the IEEE-754 standard
format (32bits), the only difference being that byte 1 and 2 are changed over
with byte 3 and 4.
Single-float format (32bit) as per IEEE 754standard
S - sign bit
E - exponent (two's complement)
M - 23bits normalized mantissa
Modbus float format
Example Request of the float value of address 0x0035, if value "550.0" (0x44098000 in
IEEE-754 format) is written under this address.
Request: 140300350002D6C0 (CRC16 = C0D6)
Response: 140304800044096434 (CRC16 = 3464)
Once transmission from the device is completed, the bytes of the float value
need to be changed over accordingly.
A large number of compilers (e.g. Microsoft Visual C++) file the float values in
the following order:
Float value
Please find out the way float values are saved in your application. After the
request from the paperless recorder, it might be necessary to change the
bytes over in the interface program you are using.
SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM
Byte 1 Byte 2 Byte 3 Byte 4
Modbus address x Modbus address x+1
MMMMMMMM MMMMMMMM SEEEEEEE EMMMMMMM
Byte 3 Byte 4 Byte 1 Byte 2
Address x Address x+1 Address x+2 Address x+3
MMMMMMMM MMMMMMMM EMMMMMMM SEEEEEEE
Byte 4Byte 3Byte 2Byte 1