105BCommunication processor
12.5 Modbus communication
A Modbus TCP server can support concurrent connections up to the maximum number of
Open User Communications connections allowed by the PLC. The total number of
connections for a PLC, including Modbus TCP Clients and Servers, must not exceed the
maximum number of supported Open User Communications connections (Page 394). The
Modbus TCP connections may be shared between Client and/or Server type connections.
Individual server connection must follow these rules:
● Each MB_SERVER connection must use a distinct instance DB.
● Each MB_SERVER connection must be established with a unique IP port number. Only 1
● Each MB_SERVER connection must use a unique connection ID.
● The MB_SERVER must be called individually for each connection (with its respective
The Connection ID must be unique for each individual connection. This means a single,
unique Connection ID must only be used with each individual instance DB. In summary, the
instance DB and the Connection ID are paired together and must be unique for every
connection.
Table 12- 59 Modbus diagnostic function codes
MB_SERVER Modbus diagnostic functions
Codes
Sub-function
08
0x0000
08
0x000A
11
MB_SERVER variables
This table shows the public static variables stored in the MB_SERVER instance data block
that can be used in your program
Table 12- 60 MB_SERVER public static variables
Variable
HR_Start_Offset
Request_Count
Server_Message_Count
Xmt_Rcv_Count
592
connection per port is supported.
instance DB).
Description
Return query data echo test: The MB_SERVER will echo back to a Modbus client a word of data
that is received.
Clear communication event counter: The MB_SEVER will clear out the communication event
counter that is used for Modbus function 11.
Get communication event counter: The MB_SERVER uses an internal communication event
counter for recording the number of successful Modbus read and write requests that are sent to
the Modbus server. The counter does not increment on any Function 8 or Function 11 requests. It
is also not incremented on any requests that result in a communication error.
The broadcast function is not available for Modbus TCP, because only one client-server
connection exists at any one time.
Data type Default
value
Word
0
Word
0
Word
0
Word
0
Description
Assigns the starting address of the Modbus Holding register
The number of all requests received by this server.
The number of requests received for this specific server.
The number of transmissions or receptions that have encountered an
error. Also, incremented if a message is received that is an invalid
Modbus message.
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05