The connection ID must be unique for each individual connection. A single, connection ID
must be used with each individual instance DB. The instance DB and the connection ID are
paired together and must be unique for every connection.
Table 13- 66 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 that are stored in the MB_SERVER instance data
block and can be used in your program
Table 13- 67 MB_SERVER public static variables
Variable
HR_Start_Offset
Request_Count
Server_Message_Count
Xmt_Rcv_Count
Exception_Count
Success_Count
Connected
Your program can write data to the HR_Start_Offset and control Modbus server operations.
The other variables can be read to monitor Modbus status.
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
Description
Return query data echo test: The MB_SERVER will echo back to a Modbus client a data word
that is received.
Clear communication event counter: The MB_SEVER will clear 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 request for Function 8, Function 11,
or any request that results in a communication error.
The broadcast function is not available for Modbus TCP, because only one client-server connec-
tion exists at any one time.
Data type Default
Word
0
Word
0
Word
0
Word
0
Word
0
Word
0
Bool
0
Communication processor and Modbus TCP
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.
Modbus specific errors that require a returned exception
The number of requests received for this specific server that has no
protocol errors.
Indicates whether the connection to the assigned client is connected or
disconnected: 1=connected, 0=disconnected
13.5 Modbus communication
1183