Navigation:  Equipments (Devices) > PLC200 > Network Protocols >

Modbus TCP

Previous pageReturn to chapter overviewNext page

This guide will help you set up the device as a Modbus TCP Client to connect with one or more Modbus TCP Servers.

 

IMPORTANT!

Before using this service please be aware of the IMPORTANT NOTICE CYBERSECURITY AND COMMUNICATIONS

 

The Modbus TCP client is configured through a configurator.

 

wpshelp_common_fig_note

NOTE!

For detailed information about how the client reads and writes data using Modbus TCP, see the specific device manual for Modbus TCP communication.

 

1)  Expand the Communications directory.

 

mb_tcp_example_01

 

2) Right-click in Modbus TCP and click to create a new file.

mb_tcp_example_02

 

3) Enter a name to the new Modbus TCP configuration and click on Finish.

mb_tcp_example_03

 

4)  Double-click on the new Modbus TCP configuration file to open the configurator tab

 

mb_tcp_example_04

 

5) Right-click on the main network node PLC and click on the Add Device option.

 

mb_tcp_example_05

 

6) On the Add Device panel set up the device information:

 

Name: Enter a name for the device, this name must be unique for any Modbus configurations;
IPv4 Address: The Modbus TCP device address.
Port: The Modbus TCP device port.
UnitID: The Modbus TCP device Unit ID.
Response Timeout: The timeout to connect to the device.
Connection ID: The connection ID to this Modbus device.

 

mb_tcp_example_06

 

wpshelp_common_fig_note

NOTE!

Each device has a limit of simultaneous connections, in other words, Connection IDs. If the network has more devices (Modbus Servers) than this limit. The devices will need to share connections ID.

 

7) After setting up a device, right-click on it to add requests.

 

mb_tcp_example_07

 

8) On Add Request panel set up the request informations:

 

Name: A name for request, this name must be unique for any Modbus configurations.
Function:

           1: Read Coils

           2: Read Discrete Inputs

           3: Read Holding Registers

          4: Read Input Registers

          5: Write Single Coil

          6: Write Single Register

          15: Write Multiple Coils

          16: Write Multiple Registers

Initial Data Address: The address or number of register or coil, depends of the Addressing Mode set up.
Length: Number of registers or coils to be read or written.
Addressing Mode:

          0: Register address - Define that the Initial Data Address set up the register address;

          1: Register number (Modicon) - Define that the Initial Data Address set up the register number, first, second, etc.

Error Handling:

          0: Keep last value

          1: Set to zero

Event:

          0: Cyclic

           1: Rising Edge

           2: Initialization

Cycle Time: Request cyclic execution time
Event Variable: Variable for Rising Edge event.
Variable: Input or Output variable, depends on the Modbus function type

 

mb_rtu_example_10

 

8.1) To create a Global Variable to request click on the Ellipsis points button and select Global's Scope and Group.

 

mb_rtu_example_08

 

8.2) Click on the Add button to open the Variable panel and enter a name to the new Variable, a size according with Request Length and the variable Datatype, to conclude click on OK button

mb_rtu_example_09

 

9) A request will be created, on the right split window the information about the selected request or device is showed.

 

mb_tcp_example_08

 

10) Repeat the steps to create the Modbus TCP network.

 

mb_tcp_example_09

 

wpshelp_common_fig_note

NOTE!

The Modbus configurator will suggest a new Connection ID. Change it manually if necessary.

 

mb_rtu_example_12

 

wpshelp_common_fig_note

NOTE!

If your network has more than one device with the same requests you can Clone an existent device althout create a new one.

 

10.1) To Clone a device, right-click on it and choose the Clone option.

 

mb_tcp_example_10

 

wpshelp_common_fig_note

NOTE!

The device will be cloned with the same requests, new variables will be created for this new device.

 

mb_rtu_example_14

 

wpshelp_common_fig_note

NOTE!

When you use the Modbus Configurator to create the Modbus Network the configurator will create global variables of datatype MODBUS to devices and variables of datatype MB_REQUEST to requests.

 

mb_rtu_example_15

 

11) The configuration must be compiled before downloading to the device.

 

wpshelp_common_fig_note

NOTE!

Any doubt about this process access the COMPILE session.

 

mb_tcp_example_11

 

wpshelp_common_fig_note

NOTE!

Is possible to create more than one Modbus TCP configuration but just one can be selected per device.

 

11.1) In cases where there is more than one Modbus TCP configuration, click the right button and select the main file.

 

mb_tcp_example_12

 

12) After compile the project, click on download button, check the option Communication features and observe if "modbus-tcp.bin" is on Internal memory files list.If yes, click in OK button to start the download.

 

mb_tcp_example_13

 

 

 

 

Other functions:

 

A) Monitoring

 

A.1) The Modbus TCP communication can be monitored using the configurator panel.

 

mb_rtu_example_22

 

 

 

 

B) Disable and Enable

 

wpshelp_common_fig_note

NOTE!

On Modbus configurator is possible to Disable and Enabled devices and request before compile the project.

 

B.1) To disable a request, click with right button on it and select Disable.

 

mb_rtu_example_16

 

B.2) Verify that the request will be disabled on the network.

 

mb_rtu_example_17

 

B.3) To enable, click on the disabled request and select Enable.

 

mb_rtu_example_18

 

 

 

 

C) General client settings

 

C.1) To change the Connection Timeout, click with right button on the main node PLC and select Settings.

 

mb_rtu_example_23

 

C.2) Set up the Connection Timeout in milliseconds.

 

mb_tcp_example_14