Modbus floating point values

A

Thread Starter

Anonymous

I am trying to send the floating point values from a specific device to ABB DCS AC460 controller using RS485 link with Modbus Protocol. The device will send the data in 32 bit IEEE 754 format. It has various options of register format selections like 16 bit Modicon or 32 bit or 16 bit swapped. the device will support Modbus function code 03 and also function code 04. When I send a value say 45.67 to DCS, it reads the value in two 16 bit registers. First register shows 45 and second register shows 0. I tried various register formats mentioned above but still the value shown in DCS is same. Can any one help me in this regard to read the data of the device onto DCS?
 
D

Daniel Chartier

Hello;

There are many ways to do this, but the easiest way is to use 16-bit registers (integers) native to Modbus comms.:

- Multiply the floating-point value to be sent by a factor that will give you the number of decimal points to be recuperated (Your example, value 45.67 would be multiplied by 100.0 = 4567.0) then cast as an integer value (=4567);
- Transfer the data to the Modbus master using function 3 or 4, depending on the mapping chosen;
- Upon reciept of the data (=4567), transfer the value to a REAL format (=4567.0) and divide by the appropriate factor: (4567.0 / 100.0 = 45.67).

Hope this helps,
Daniel Chartier
 
I am assuming here that the DCS is the master on the modbus link and the device is the slave.

It sounds like although the device itself supports IEEE FP numbers the DCS is not decoding the 32bit representation correctly. To my knowledge the modbus protocol does not natively support the transfer of FP numbers. Some DCSs have a built in algorithm to decode a FP number retrieved through the modbus protocol and some do not. Searching on the web for IEEE754 should get you the details of the standard/algorithm and in particular show you how FP numbers are represented in 32 bits. bits 1-23 are the mantissa, bits 24-31 the exponent and bit 32 the sign from memory. Does this DCS have a FP option?
 
Top