Modbus Manager

Introduction

The Modbus Manager is used for Modbus RTU or ASCII protocol in master or slave mode.

It is recommended to use the Relocation Table to optimize the communication between the controller and other equipment.

NOTE: Modbus Manager is automatically added to the Serial Line 2 node of the Devices tree.

Adding the Modbus Manager

To add a Modbus Manager to your controller, select the Modbus Manager in the Hardware Catalog, drag it to the Devices tree, and drop it on one of the highlighted nodes.

Configure the Modbus Manager

To configure the Modbus_Manager of your controller, proceed as follows:

Step

Action

1

In the Devices tree, double-click Modbus_Manager.

Result: The Modbus_Manager configuration window is displayed if Modbus_Manager is already configured on this serial line port.

G-SA-0045237.3.gif-high.gif

 

 

Configuring the Modbus Manager

Set the parameters as described in the following table:

Element

Description

Transmission Mode

Specify the transmission mode to use:

oRTU: uses binary coding and CRC error-checking (8 data bits).

oASCII: messages are in a ASCII format, LRC error-checking (7 data bits).

This parameter must be identical for each Modbus device on the link.

Addressing

Specify if the M218 device is master or slave.

Address

Modbus address of the device.

Time between frames (ms)

Time to avoid bus-collision.

This parameter must be identical for each Modbus device on the link.

Serial Line Settings

Parameters specified in [Physical Settings] of the Serial Line configuration menu.

Modbus Master

When the controller is configured as a Modbus Master, the following Function Blocks are supported from the PLCCommunication Library:

oADDM

oREAD_VAR

oSEND_RECV_MSG

oSINGLE_WRITE

oWRITE_READ_VAR

oWRITE_VAR

For further information, see Function Block Descriptions of the PLCCommunication Library.

Modbus Slave

When the controller is configured as Modbus Slave, the following Modbus requests are supported:

Types

Function

Function Codes

Code/Sub Code

Data Access (1 Bit)

Physical Discrete Inputs and Outputs

Read digital outputs (%Q)

01

Read digital inputs (%I)

02

Write Multiple digital outputs (%Q)

15

Data Access (16 Bits)

Physical Input Registers

Read Holding Registers (%MV)

03

Write Single Register (%MV)

06

Write Multiple Registers (%MV)

16

Read/Write Multiple Registers (%MV)

231

Diagnostics

Diagnostics

08

Read Device Identification

43/14

1 When a slave replies to function code 23 with the return code ILLEGAL FUNCTION, the master will send function codes 03 and 16.

NOTE: Only located variables of the controller application can be accessed via Modbus.

The following table contains the Sub-function codes supported by the diagnostic Modbus request 08:

Sub-Function Code

Function

Dec

Hex

 

10

0A

Clear Counters and Diagnostic Register

11

0B

Return Bus Message Count

12

0C

Return Bus Communication Error Count

13

0D

Return Bus Exception Error Count

14

0E

Return Slave Message Count

15

0F

Return Slave No Response Count

16

10

Return Slave NAK Count

17

11

Return Slave Busy Count

18

12

Return Bus Character Overrun Count

The table below list the objects that can be read with a read device identification request (basic identification level):

Object ID

Object Name

Type

Value

00 hex

Vendor code

ASCII String

Schneider Electric

01 hex

Product code

ASCII String

Controller reference

e.g. TM218LDA24DRN

02 hex

Major / Minor revision

ASCII String

aa.bb.cc.dd (same as device descriptor)

The following section describes the differences between the Modbus memory mapping of the controller and HMI Modbus mapping. If you do not program your application to recognize these differences in mapping, your controller and HMI will not communicate correctly and it will be possible for incorrect values to be written to memory areas responsible for output operations.

Warning_Color.gifWARNING

UNINTENDED EQUIPMENT OPERATION

Program your application to translate between the Modbus memory mapping used by the controller and that used by attached HMI devices.

Failure to follow these instructions can result in death, serious injury, or equipment damage.

When the controller and the HMI are connected via Modbus (HMI is master of Modbus requests), the data exchange uses simple word requests.

There is an overlap on simple words of the HMI memory while using double words but not for the controller memory (see following diagram). In order to have a match between the HMI memory area and the controller memory area, the ratio between double words of HMI memory and the double words of controller memory has to be 2.

G-SE-0005272.2.gif-high.gif

 

 

The following gives examples of memory match for the double words:

o%MD2 memory area of the HMI corresponds to %MD1 memory area of the controller because the same simple words are used by the modbus request.

o%MD20 memory area of the HMI corresponds to %MD10 memory area of the controller because the same simple words are used by the modbus request.

The following gives examples of memory match for the bits:

o%MW0:X9 memory area of the HMI corresponds to %MX1.1 memory area of the controller because the simple words are split in 2 distinct bytes in the controller memory.

NOTE: If %MD is used for data exchange between PLC and HMI, the word order should be consistent between PLC and HMI. For Modicon M218 Logic Controller, the order of double word variable is low word first.