Print

Modbus-TCP communication between our Ethernet HMIs and Schneider M218 M241 M251 M262 PLCs

Modbus TCP Client/Server of the M218 M241 M251 M262 PLCs

Unlike Modbus serial link, Modbus TCP is not based on a hierarchical structure, but on a client/server model.

The Modicon M241 Logic Controller implements both client and server services so that it can initiate communications to other controllers and I/O devices, and to respond to requests from other controllers, SCADA, HMIs, and other devices.

Without any configuration, the embedded Ethernet port of the controller supports Modbus server.

The Modbus client/server is included in the firmware and does not require any programming action from the user. Due to this feature, it is accessible in RUNNING, STOPPED and EMPTY states.

M2xx Logic Controller as a Slave Device on Modbus TCP

To configure your M241 Logic Controller as a Modbus TCP Slave Device, you must add Modbus TCP Slave Device functionality to your controller. This functionality creates a specific I/O area in the controller that is accessible with the Modbus TCP protocol. This I/O area is used whenever an external master needs to access the %IW and %QW objects of the controller. This Modbus TCP Slave Device functionality allows you to furnish to this area the controller I/O objects which can then be accessed with a single Modbus read/write registers request.

The Modbus TCP Slave Device adds another Modbus server function to the controller. This server is addressed by the Modbus client application by specifying a configured Unit ID (Modbus address) in the range 1…247. The embedded Modbus server of the slave controller needs no configuration, and is addressed by specifying a Unit ID equal to 255.

Inputs/outputs are seen from the slave controller: inputs are written by the master, and outputs are read by the master.

The Schneider Modbus server supports the Modbus requests:

Function Code
Dec (Hex)

Subfunction
Dec (Hex)

Function

1 (1)

Read digital outputs (%Q)

2 (2)

Read digital inputs (%I)

3 (3)

Read holding register (%MW)

6 (6)

Write single register (%MW)

8 (8)

Diagnostic

15 (F)

Write multiple digital outputs (%Q)

16 (10)

Write multiple registers (%MW)

23 (17)

Read/write multiple registers (%MW)

43 (2B)

14 (E)

Read device identification

NOTE: The embedded Modbus server only ensures time-consistency for a single word (2 bytes). If your application requires time-consistency for more than 1 word, add and configure a Modbus TCP Slave Device so that the contents of the %IW and %QW buffers are time-consistent in the associated IEC task (MAST by default).

 

CommandHMI: Modbus-TCP Client (Master)