Reading REAL (Float) Values via Modbus RS485?

Hello Everyone,

I have successfully established Modbus RTU communication over RS485 between a B&R PLC (Master) and a Slave device. Currently, I can read Holding Registers correctly, and I am exchanging INT (16-bit Integer) values without any issues.

Now I would like to transfer REAL (Float) values between the Master and Slave.

My questions are:

  1. Does Modbus RTU support REAL (Float) data types directly?
  2. Since a Holding Register is 16-bit, does a REAL value require two consecutive registers (32-bit)?
  3. What is the recommended method in B&R Automation Studio to read and write REAL values through Modbus?
  4. How should the Master combine two registers into a REAL value?
  5. Is there any specific byte order or word order (Endian format) that I need to consider?
  6. Could anyone provide a simple example of mapping a REAL variable to Modbus Holding Registers and reading it on the Master side?

Example:

  • Slave REAL Value = 25.75
  • Holding Register 40001 = ?
  • Holding Register 40002 = ?
  • Master reads these two registers and converts them back to REAL.

I would appreciate any examples, documentation references, or best practices.

Thank you.

Hi,

please see here…

… and here

Best regards!