105BCommunication processor
12.5 Modbus communication
S7-1200 Programmable controller
592
System Manual, 11/2011, A5E02486680-05
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
connection per port is supported.
●
Each MB_SERVER connection must use a unique connection ID.
●
The MB_SERVER must be called individually for each connection (with its respective
instance DB).
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 Description
08
0x0000
Return query data echo test: The MB_SERVER will echo back to a Modbus client a word of data
that is received.
08
0x000A
Clear communication event counter: The MB_SEVER will clear out the communication event
counter that is used for Modbus function 11.
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.
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
Data type Default
value
Description
HR_Start_Offset
Word
0
Assigns the starting address of the Modbus Holding register
Request_Count
Word
0
The number of all requests received by this server.
Server_Message_Count
Word
0
The number of requests received for this specific server.
Xmt_Rcv_Count
Word
0
The number of transmissions or receptions that have encountered an
error. Also, incremented if a message is received that is an invalid
Modbus message.