Floating point data represented as 4-byte integers
- Last UpdatedSep 28, 2022
- 1 minute read
Certain devices, such as the Motherwell Controls Series 5000 Tank Gauging System, represent floating point numbers in an integer format. These values require division by a conversion factor to convert them from integers to their proper floating-point value. For example, the floating-point value of 16.4 can be represented by a 2 byte integer containing the value of 164: byte0 = 0, byte1 = 164 (decimal). A conversion factor of 10 is used (the raw value is divided by 10) to convert the value to 16.4. A floating-point value of -16.4 can be represented by a 2-byte integer containing -164; byte0 = 255, byte1 = 92. Again the value is divided by the conversion factor, 10, to yield -16.4. The integer range for 2 byte integers is (-32768) to (32767).
Four (4) byte integers can also be used to hold floating point numbers. The same conversion equation that applies to 2 byte integers applies to 4 byte integers as well. Data type 7 is used to indicate that data will be 4-byte integer values. The integer range for 4 byte integers is (-2147483648) to (2147483647).
The Square Root Code should be set to 3 to indicate the integer to floating point conversion as described above. The appropriate Conversion Factor should be entered and the Point Type should be R. For integer representation, only the following Location3 entries are supported at the present time: 103, 104, 703, 704 and (for write) 106, 706. The default is for the ModbusE interface to expect the high order register first.