Communication processor and Modbus TCP
13.5 Modbus communication
S7-1200 Programmable controller
1176 System Manual, V4.2, 09/2016, A5E02486680-AK
CONNECT parameter assigns data used to establish a PROFINET connection
You must use a global data block and store the required connection data before you can
reference this DB at the CONNECT parameter.
1. Create a new global DB or use an existing global DB to store the CONNECT data. You
can use one DB to store multiple TCON_IP_v4 data structures. Each Modbus TCP client
or server connection uses a TCON_IP_v4 data structure. You reference the connection
data at the CONNECT parameter.
2. Name the DB and a static variable with a helpful name. For example, name the data
block "Modbus connections" and a static variable "TCPactive_1" (for Modbus TCP client
connection 1).
3. In the DB editor, assign the system data type "TCON_IP_v4" in the Data Type column, for
the example static variable "TCPactive_1".
4. Expand the TCON_IP_v4 structure so you can modify the connection parameters, as
shown in the following image.
5. Modify data in the TCON_IP_v4 structure for an MB_CLIENT connection.
6. Enter the DB structure reference for the CONNECT parameter of MB_CLIENT. For the
example, this would be "Modbus connections".TCPactive_1.
Modify TCP_IP_v4 DB data for each MB_CLIENT connection
●
: Using the Device configuration window, click on the CPU PROFINET port
image. Then click on the General properties tab and use the Hardware identifier that you
see there.
●
: Enter a connection ID number between 1 and 4095. Modbus TCP communication is
made using underlying TCON, TDISCON, TSEND, and TRCV instructions, for OUC
(Open User Communication).
●
: For TCP/IP, use the default 16#0B (decimal number = 11).
●
: This value must be 1 or TRUE. The connection is active in that
MB_CLIENT initiates Modbus communication.
●
: Enter the IP address of the target Modbus TCP server into the four
ADDR array elements. For example, enter 192.168.2.241, as in the previous image.