Introduction:
MODBUS RTU is a widely used communication protocol in industrial automation, enabling seamless data exchange between master and slave devices. One essential aspect of MODBUS RTU is the addressing scheme, involving both the Protocol Data Unit (PDU) and logical addresses. In this post, we will explore how the negotiated presentation of the PDU streamlines communication and the conversion process between PDU addresses and logical addresses for different types of registers.

 

Protocol Data Unit (PDU) presentation:
In MODBUS RTU, the PDU (Protocol Data Unit) is a crucial part of the communication frame used to exchange data between the master and slave devices. The PDU is structured to include the following components:
Function Code (1 byte): The function code serves as a command that instructs the slave device on the type of action the master device wants to perform. It is a single-byte value that indicates operations such as reading data, writing data, or requesting diagnostic information.
Register address (2 bytes): The register address field specifies the starting point of the register in the slave device’s memory. It is a two-byte value that helps the master device identify the location of the data to be accessed or manipulated. Within the definition of the PDU, Modbus defines the address of each data element as ranging from 0 to 65535
Additional data fields (up to 250 bytes): Depending on the specific function code, the PDU may include additional fields with varying lengths, extending up to 250 bytes. These additional fields carry the necessary data to execute the requested operation. For example, when reading data, the additional fields might include the number of registers to read, while writing data would require the values to be written to the registers.

Demystifying MODBUS RTU addressing MODBUS RTU PDU

By including the function code, register address, and additional fields in the PDU, MODBUS RTU ensures efficient and reliable data exchange between the master and slave devices.

 

Understanding the four types of registers:

MODBUS RTU defines four types of registers, each serving distinct purposes in industrial automation:

  • Coils (Discrete outputs): Coils represent binary outputs that can be controlled by the master device. They have two states: ON (1) and OFF (0). Coils are read and written by the master, allowing it to control various industrial processes.
  • Discrete inputs: Discrete inputs provide binary input data to the master device. These registers are read-only for the master and typically represent the status of sensors or switches.

 

  • Input registers: Input registers store analog data or data received from sensors. These registers are read-only for the master and provide valuable information about the external environment.
  • Holding registers: Holding registers serve as a two-way communication channel, allowing both read and write operations. They are commonly used to control slave devices and store temporary data.

 

Calculating Logical Addresses from PDU Addresses:
The MODBUS application protocol defines precisely PDU addressing rules. In a MODBUS PDU, each data is addressed from 0 to 65535.
It also defines clearly a MODBUS data model composed of 4 blocks that comprise several elements numbered from 1 to n.

Demystifying MODBUS RTU addressing data_block

To convert the PDU addresses to logical addresses for Coils, Discrete inputs, Input registers, and Holding registers, an offset is applied. The conversion formula is as follows:

Logical Address = Register Address + Offset

or

Register Address = Logical Address – Offset

According to modbus.org: “The offsets (pre-mapping) between the MODBUS data model and the device application is totally vendor device specific.”

For example, instead of referring to an item as holding register 14 at address 13, a device manual would use the following representations: 4014 (offset = 4001), 40014 (offset = 40001), or 400014 (offset = 400001). In each case, the first number, 4, indicates holding registers. The choice between 4XXX, 4XXXX, and 4XXXXX depends on the device’s address space. For instance, if all 65536 registers are in use, 4XXXXX notation is utilized, allowing a range from 400001 to 465536. Conversely, if only a few registers are used, the common practice is to use the range 4001 through 4999.

In various manufacturers’ documentation, the address of a holding register can be represented in multiple ways, which can lead to confusion. Here are the different representations:

·         PDU address 13

·         Logical address 4014 (obviously, here the offset is 4001)

·         Logical address 40014 (obviously, here the offset is 40001)

·         Logical address 400014 (obviously, here the offset is 400001)

However, it’s important to understand that regardless of the logical address (offset) used, at the physical communication level, the PDU address is always utilized. Here are some examples:

·         For logical address 4014 and offset 4001 -> PDU address = 4014 – 4001 = 13

·         For logical address 40014 and offset 40001 -> PDU address = 40014 – 40001 = 13

·         For logical address 400014 and offset 400001 -> PDU address = 400014 – 400001 = 13

This clarification ensures that regardless of the representation, the actual communication uses the PDU address consistently.

The opposite can also happen. In the manufacturer’s documentation for the input register, PDU address 33 is used. However, the SCADA software works with the format 3XXXXXX for input registers.

Obviously, the offset here is 300001. The logical address to set in the software is calculated as follows:

Logical address = PDU address + Offset = 33 + 300001 = 300034

Understanding these representations is essential for accurate communication and management of industrial processes.

Examples:

–     In the documentation for iEM3250 energy meter Schneider Electric uses for holding registers addresses 30, 50, 70, etc. It is obvious that offset is 0, in other words here are presented PDU addresses:

Demystifying MODBUS RTU addressing Modbus register list

To read the “Serial number” with SCADA software working with logical addresses 4XXXXX, the following logical address should be used:

Logical address = PDU address + Offset = 130 + 400001 = 400131

–     In the documentation for power and energy meter PR720 Yokogawa uses 4XXXX format for holding registers:

Demystifying MODBUS RTU addressing data address list

It is obvious that the offset is 40001 here.

The PDU address for “Demand current Upper limit value” will be:

PDU address = 40106 – 40001 = 105

Conclusion:

Understanding the conversion process between PDU addresses and logical addresses is crucial for effective communication in MODBUS RTU-based industrial automation systems. By applying the correct offsets and utilizing negotiated presentation, engineers and operators can streamline data exchange and ensure seamless industrial operations.

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.