How to read Modbus Registers that return one 32-bit register instead of two16-bit registers for 32-bit data types
My device is using the Modbus protocol and I am having trouble reading my registers as 32-bit floating point. How do I access Modbus registers if they are native 32-bit registers on the device instead of the standard native 16-bit word registers?
Normal Modbus addressing requires that if reading a 32-bit address, the server is required to ask for two 16-bit word registers. This Device returns a 32-bit response if just a single address is requested. When we make a request for a 32-bit data type we request two addresses and the device sends back 64-bits or 32-bits for each address when we expect just 32-bits. This results in communication errors. There is a way to use the TOP Server Modbus Suite to read and write to these type of devices.
Here is the setup that is necessary to read registers from devices that have native 32-bit registers instead of native 16-bit registers:
- The channel configuration uses Modbus Serial with Ethernet Encapsulation, assuming this is an Ethernet based device. (Defaults on the other settings)
- The device configuration:
- Model needs to be Elliott (It has the address block types that we need)
- ID is 1 (This is the number that was at the end of the Device ID/IP for your Modbus Ethernet device configuration)
- Ethernet Encapsulation:
- IP Address is just the IP of your device
- Port needs to be 502 for Ethernet communications
- Protocol is TCP/IP
- Settings:
- These should match the device specific settings.
- Framing:
- It is most important that the "Use Modbus TCP framing" box be checked for this configuration to work (When the device supports Modbus TCP).
- All other settings should be fine at the defaults.
This configuration is necessary because the Elliott model of Modbus addressing has two blocks of native 32-bit register addresses that you should be able to use for your 32-bit float registers. The only stipulation is that they are a specific range of addresses and, for this work, you will have to map your address on the device to those specific blocks of addresses.
These blocks are as follows:
- 405001 - 405315 are 32-bit registers
- 407001 - 407315 are 32-bit registers
Since the Modbus driver reads two registers when a 32-bit data type has been requested, using the standard configuration for a Modbus Ethernet device will not work. This setup allows the driver to request just one register when requesting a 32-bit data type because those blocks of addresses are native 32-bit data types.