Unlike Modbus serial link, Modbus TCP is not based on a hierarchical structure, but on a client/server model.
The Modicon M251 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.
The Modbus TCP client supports the following function blocks from the PLCCommunication library without any configuration:
oADDM
oREAD_VAR
oSEND_RECV_MSG
oSINGLE_WRITE
oWRITE_READ_VAR
oWRITE_VAR
For further information, refer to the Function Block Descriptions.
The 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).