Modbus TCP Client/Server

Introduction

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

The Modicon M262 Logic/Motion 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.

Modbus TCP Client

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.

Modbus TCP Server

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

Diagnostic Request

This table contains the data selection code list:

Data Selection Code (hex)

Description

00

Reserved

01

Basic Network Diagnostics

02

Ethernet Port Diagnostic

03

Modbus TCP/Port 502 Diagnostics

04

Modbus TCP/Port 502 Connection Table

05 - 7E

Reserved for other public codes

7F

Data Structure Offsets