Modbus TCP Cyclic Data Exchanges Configuration

Overview

To configure the Modbus TCP cyclic data exchanges, you have to:

oConfigure for each Modbus TCP slave devices the data exchanges request (on channels) and the I/O Mapping.

oConfigure the I/O scanner for Modbus TCP slave devices.

Modbus TCP Channel

A Modbus channel carries a Modbus request between the master and a slave.

For a generic slave device, you can use multiple channels. To send several different requests to a device, create several channels.

Configure the Modbus TCP Slave Device Channels

Step

Action

1

In the Devices tree, double-click a Modbus TCP slave device.

Result: Its configuration window is displayed.

2

Click the Modbus TCP Channel Configuration tab:

G-SE-0047914.2.gif-high.gif

 

 

3

To remove a non-predefined channel, select it and click Delete.

4

To change the parameters of a channel, select the channel and click Edit.

NOTE: For the devices that provide predefined channels, only the Repetition Rate value can be modified.

5

To add a channel, click Add Channel.

This dialog box is displayed:

G-SE-0031834.1.gif-high.gif

 

 

6

In the Channel area, you can define:

oName: optional string for naming the channel.

oUnit-ID [1..255]: unit ID (1) of the Modbus TCP slave device (by default 255).

oRepetition Rate: polling interval of the Modbus request (by default 20 ms).

oComment: optional field to describe the channel.

oFunction Code: type of Modbus request:

oRead/Write Multiple Registers (Function code 23) (by default).

oRead Holding Registers (Function code 03).

oWrite Multiple Registers (Function code 16).

In the READ register area, you can define:

oOffset: starting register number to read from 0 to 65535.

oLength: number of the registers to be read (depending on the function code).

oError Handling: define the fallback value in the case of a communication interruption:

oKeep Last Value (by default) holds the last valid value.

oSetToZero resets the values to 0.

In the WRITE register area, you can define:

oOffset: starting register number to write from 0 to 65535.

oLength: number of the registers to be written (depending on the function code).

7

Click OK to validate the configuration of the channel.

8

Repeat steps 5 to 7 to create other channels that define the Modbus communication with the device. For each Modbus request, you must create a channel.

 

(1) Unit identifier is used with Modbus TCP devices which are composed of several Modbus devices, for example, on Modbus TCP to Modbus RTU gateways. In such case, the unit identifier allows reaching the slave address of the device behind the gateway. By default, Modbus/TCP-capable devices ignore the unit identifier parameter.

Read/Write Register Length

The read/write register length depends on the Modbus function code.

This table contains, for 1 channel, the maximum length of the read/write registers:

Modbus function code

Maximum length

Read register

Write register

Read/write multiple registers (function code 23)

125

121

Read registers (function code 03)

125

-

Write registers (function code 16)

-

123

NOTE: Due to these limitations and the maximum input/output words of the scanner (2048), verify the scanner resources overload.