Communication processor and Modbus TCP
12.5 Modbus communication
S7-1200 Programmable controller
730 System Manual, 03/2014, A5E02486680-AG
MB_CLIENT (Communicate via PROFINET as Modubus TCP client) instruction
Table 12- 49 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
communication hardware module
is required.
MB_CLIENT can make a client-
server connection, send a
Modbus function request, receive
a response, and control the
disconnection from a Modbus
TCP server.
Table 12- 50 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
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
instruction 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
IP_OCTET_3 IN USInt 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.