EasyManua.ls Logo

Prevac MG15 - Float IEEE-754 Format in Modbus Table; Example Loat IEEE-754 Value in Modbus Table

Prevac MG15
122 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
MULTI GAUGE CONTROLLER COMMUNICATION
6.4.7.1 ENUMERATED, BOOL AND INTEGER PARAMETERS
These variables are always occupying one word in the memory. For variables smaller than: 2 bytes,
the upper byte is illed with 0x00 value.
These variables are read via 0x03 function, and they can be recorded via 0x06 or 0x10 function.
Remember to ill with 0x00 the upper byte (MSB) of variables smaller than 2 bytes during writing.
6.4.7.2 FLOAT TYPE
The format is compatible with the IEEE-754 standard and is used in almost every programming lan-
guage of higher level such as C, C++. In addition, most of automatics equipment or built-in systems
allows for their automatic decoding.
Variables written in this format are organised as 4-byte data in two consecutive table word in the
“MSB irst” order. Writing and reading of these variables is possible only via 0x03 and 0x10 com-
mands. An attempt to write or read such variable in half will be discarded and an error message
will be generated.
Note that in practice, when using C, IEEE loats may usually be decoded by
placing the values returned over comms into memory and ‘casting’ the region
as a loat, although some compilers may require that the area be byte swapped
high to low before casting (e.g. MSB B2 B1 LSB →LSB B1 B2 MSB).
MODBUS ADDRESS MODBUS ADDRESS + 1
MSB LSB MSB LSB
Bits 31 - 24 Bits 23 - 16 Bits 15 - 8 Bits 7 - 0
Table 6.10: Float IEEE-754 format in Modbus table
For example, to transfer the value 1.001, the following values are transmitted (hexadecimal):
MODBUS ADDRESS MODBUS ADDRESS + 1
MSB LSB MSB LSB
0x3F 0x80 0x20 0xC5
Table 6.11: Example loat IEEE-754 value in Modbus table
User manual rev. 03 Page 99

Table of Contents