Communication processor and Modbus TCP
13.8 Legacy Modbus TCP communication
S7-1200 Programmable controller
1250 System Manual, V4.2, 09/2016, A5E02486680-AK
Legacy Modbus TCP instructions
13.8.3.1
MB_CLIENT (Communicate using PROFINET as Modbus TCP client)
Table 13- 129 MB_CLIENT instruction
REQ:=_bool_in_,
DISCONNECT:=_bool_in_,
CONNECT_ID=_uint_in_,
IP_OCTET_1:=_byte_in_,
IP_OCTET_2:=_byte_in_,
IP_OCTET_3:=_byte_in_,
IP_OCTET_4:=_byte_in_,
IP_PORT:=_uint_in_,
MB_MODE:=_usint_in_,
MB_DATA_ADDR:=_udint_in_,
MB_DATA_LEN:=_uint_in_,
DONE=>_bool_out_,
BUSY=>_bool_out_,
ERROR=>_bool_out_,
STATUS=>_word_out_,
MB_DATA_PTR:=_variant_inout_);
MB_CLIENT communicates as a
Modbus TCP client through the
PROFINET connector on the S7-
1200 CPU. No additional commu-
nication hardware module is re-
quired.
MB_CLIENT can make a client-
server connection, send a Mod-
bus function request, receive a
response, and control the discon-
nection from a Modbus TCP serv-
er.
Table 13- 130 Data types for the parameters
REQ In Bool FALSE = No Modbus communication request
TRUE = Request to communicate with a Modbus TCP server
DISCONNECT IN Bool The DISCONNECT parameter allows your program to control connection
and disconnection with a Modbus server device.
If DISCONNECT = 0 and a connection does not exist, then MB_CLIENT
attempts to make a connection to the assigned IP address and port number.
If DISCONNECT = 1 and a connection exists, then a disconnect operation is
attempted. Whenever this input is enabled, no other operation will be at-
CONNECT_ID IN UInt The CONNECT_ID parameter must uniquely identify each connection within
the PLC. Each unique instance of the MB_CLIENT or MB_SERVER instruc-
tion must contain a unique CONNECT_ID parameter.
IP_OCTET_1 IN USInt Modbus TCP server IP address: Octet 1
8-bit part of the 32-bit IPv4 IP address of the Modbus TCPserver to which
the client will connect and communicate using the Modbus TCP protocol.
Modbus TCP server IP address: Octet 2
Modbus TCP server IP address: Octet 3
Modbus TCP server IP address: Octet 4
IP_PORT IN UInt
Default value = 502: The IP port number of the server to which the client will
attempt to connect and ultimately communicate using the TCP/IP protocol.