Communication processor and Modbus TCP
13.5 Modbus communication
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
1179
MB_SERVER (Communicate using PROFINET as Modbus TCP server) instruction
Table 13- 62 MB_SERVER instruction
DISCONNECT:=_bool_in_,
CONNECT:=_variant_in_,
NDR=>_bool_out_,
DR=>_bool_out_,
ERROR=>_bool_out_,
STATUS=>_word_out_,
MB_HOLD_REG:=_variant_inout_);
MB_SERVER communicates as a Modbus
TCP server through the PROFINET port on
the S7-1200 CPU. No additional communi-
cation hardware module is required.
MB_SERVER can accept a request to con-
nect with Modbus TCP client, receive a
Modbus function request, and send a re-
sponse message.
Table 13- 63 Data types for the parameters
DISCONNECT IN Bool MB_SERVER attempts to make a "passive" connection with a partner device.
This means that the se
rver is passively listening for a TCP connection request
from any requesting IP address.
If DISCONNECT = 0 and a connection does not exist, then a passive connec-
tion can be initiated.
If DISCONNECT = 1 and a connection exists, then a disconnect operation is
initiated. This parameter allows your program to control when a connection is
accepted. Whenever this input is enabled, no other operation will be attempt-
CONNECT IN Variant Reference to a Data block structure that contains connection parameters in
the system data type "TCON_IP_v4".
MB_HOLD_REG IN_OUT Variant Pointer to the MB_SERVER Modbus holding register: The holding register
must either be a non-optimized global DB or an M memory address. This
memory area is used to hold the data a Modbus client is allowed to access
using Modbus register functions 3 (read), 6 (write), and 16 (write).
NDR OUT Bool New Data Ready: 0 = No new data, 1 = Indicates that new data has been
written by a Modbus client
DR OUT Bool Data Read: 0 = No data read, 1 = Indicates that data has been read by a
ERROR OUT Bool The ERROR bit is TRUE for one scan, after MB_SERVER execution ended
with an error. The error code at the STATUS parameter is valid only during
the single cycle where ERROR = TRUE.
Note
CPU firmware version requirement
The Modbus
TCP instructions described in this section of the manual require firmware