Communication processor and Modbus TCP
13.5 Modbus communication
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
1183
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
08 0x0000 Return query data echo test: The MB_SERVER will echo back to a Modbus client a data word
that is received.
08 0x000A
Clear communication event counter: The MB_SEVER will clear 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 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.
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
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.
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 specific errors that require a returned exception
Success_Count Word 0 The number of requests received for this specific server that has no
Connected Bool 0 Indicates whether the connection to the assigned client is connected or
disconnected: 1=connected, 0=disconnected
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.