Communication processor and Modbus TCP
13.9 Legacy Modbus RTU communication (CM/CB 1241 only)
S7-1200 Programmable controller
1282 System Manual, V4.2, 09/2016, A5E02486680-AK
This table shows the public static variables stored in the MB_SLAVE instance data block that
can be used in your program
Table 13- 158 Modbus slave variables
The number of all requests received by this slave
Slave_Message_Count Word The number of requests received for this specific slave
The number of requests received that have a CRC error
The number of broadcast requests received
Modbus specific errors that require a returned exception
Success_Count Word The number of requests received for this specific slave that have no protocol
Specifies the starting address of the Modbus Holding register (default = 0)
Extended_Addressing Bool Configures single or double-byte slave addressing
(0=single byte address, 1=double-byte address, default = 0)
Your program can write values to the HR_Start_Offset and Extended_Addressing variables
and control Modbus slave operations. The other variables can be read to monitor Modbus
status.
Modbus holding register addresses begin at 40001 or 400001. These addresses correspond
to the beginning PLC memory address of the holding register. However, you can configure
the "HR_Start_Offset" variable to start the beginning Modbus holding register address at
another value instead of 40001 or 400001.
For example, if the holding register is configured to start at MW100 and is 100 words long.
An offset of 20 specifies a beginning holding register address of 40021 instead of 40001.
Any address below 40021 and above 400119 will result in an addressing error.
Table 13- 159 Example of Modbus holding register addressing
0
20
HR_Start_Offset is a word value that specifies the starting address of the Modbus holding
register and is stored in the MB_SLAVE instance data block. You can set this public static
variable value by using the parameter helper drop-list, after MB_SLAVE is placed in your
program.