Configuring Modbus TCP Explicit Messaging Using DATA_EXCH
Original instructions
Introduction
When you use the DATA_EXCH block to create an explicit message for a Modbus TCP device, configure this block the same way you would configure it for any other Modbus communication. Refer to the Control Expert online help for instructions on how to configure the DATA_EXCH block.
Configuring ADDM Block Unit ID Settings
When you configure the DATA_EXCH block, use the ADDM block to set the DATA_EXCH block’s Address parameter. The ADDM block presents the configuration format ADDM(‘rack.slot.channel[ip_address}UnitID.message_type.protocol’) where:
The parameter...
Represents...
rack
the number assigned to the rack containing the communication module
slot
the position of the communication module in the rack
channel
the communication channel—set to a value of 0
ip_address
the IP address of the remote device, for example, 192.168.1.7
Unit ID
the destination node address, also known as the Modbus Plus on Ethernet Transporter (MET) mapping index value
message_type
the three character string TCP
protocol
the three character string MBS
The Unit ID value in a Modbus message indicates the destination of the message. The manner in which the communication module handles the Unit ID value depends upon its role as either a server or a client. When the communication module acts as a:
Modbus function code 3 provides easy access to a variety of diagnostic functions, including basic network diagnostics, Ethernet port diagnostics, and Modbus port 502 diagnostics.
To access the function code 3 diagnostics from the local device, set the Unit ID to 255.
Contents of the Received_Data Parameter
The Received_Data parameter contains the Modbus response. The length of the response varies, and is reported by Management_Param[3] after the response is received. The format of the Modbus response is described, below:
Offset (words)
Length (bytes)
Description
0
2
First word of the Modbus response:
  • High byte (MSB):
    • if successful: Modbus Function Code
    • if not: Modbus function code + 16#80
  • Low byte (LSB):
1
Length of the Received_Data parameter – 2
Remainder of the Modbus response: depends on the specific Modbus request)
NOTE: Structure the response in little endian order.