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:

Parameter

Description

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.

Refer to the Modbus diagnostic codes.

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):

    • if successful: depends on the request

    • if not: Modbus exception code

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.

  • In some cases of detected errors, Received_Data is also used to judge the type of detected error along with Management_Param.