Communication processor and Modbus TCP
13.5 Modbus communication
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
1209
Modbus_Slave must be executed periodically to receive each request from the
Modbus_Master and then respond as required. The frequency of execution for
Modbus_Slave is dependent upon the response timeout period of the Modbus_Master. This
is illustrated in the following diagram.
The response timeout period RESP_TO is the amount of time a Modbus_Master waits for the
start of a response from a Modbus_Slave. This time period is not defined by the Modbus
protocol, but is a parameter of each Modbus_Master. The frequency of execution (the time
between one execution and the next execution) of Modbus_Slave must be based upon the
particular parameters of your Modbus_Master. At a minimum, you should execute
Modbus_Slave twice within the response timeout period of the Modbus_Master.
Modbus_Slave instruction data block (DB) tags
The following table shows the public static tags stored in the Modbus_Slave instance DB that
you can use in your program:
Table 13- 85 Modbus_Slave instance DB static tags
HR_Start_Offset Word 0 Assigns the starting address of the Modbus holding register (default =
Extended_Addressing Bool FALSE Configures single or double-byte slave addressing:
• FALSE = single byte address
• TRUE = double-byte address
Total of all requests received by this slave
Number of requests received for this specific slave
Bad_CRC_Count Word 0 Number of requests received that have a CRC error
Number of broadcast requests received
Exception_Count Word 0 Modbus-specific errors that require an acknowledgement with a re-
turned exception to the master
Success_Count Word 0 Number of requests received for this specific slave that have no proto-
MB_DB MB_BASE - The MB_DB parameter of the Modbus_Comm_Load instruction must
be connected to the MB_DB parameter of the Modbus_Slave instruc-
Your program can write values to the HR_Start_Offset and Extended_Addressing tags and
control the Modbus slave operations. You can read the other tags to monitor the Modbus
status.