105BCommunication processor
12.5 Modbus communication
Modbus slave variables
This table shows the public static variables stored in the MB_SLAVE instance data block that
can be used in your program
Table 12- 78 Modbus slave variables
Variable
HR_Start_Offset
Extended_Addressing
Request_Count
Slave_Message_Count
Bad_CRC_Count
Broadcast_Count
Exception_Count
Success_Count
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.
HR_Start_Offset
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 12- 79 Example of Modbus holding register addressing
HR_Start_Offset
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.
612
Data type
Description
Word
Specifies the starting address of the Modbus Holding register (default = 0)
Bool
Configures single or double-byte slave addressing
(0=single byte address, 1=double-byte address, default = 0)
Word
The number of all requests received by this slave
Word
The number of requests received for this specific slave
Word
The number of requests received that have a CRC error
Word
The number of broadcast requests received
Word
Modbus specific errors that require a returned exception
Word
The number of requests received for this specific slave that have no protocol
errors
Address
Modbus address (Word)
S7-1200 address
Modbus address (Word)
S7-1200 address
Minimum
40001
MW100
40021
MW100
System Manual, 11/2011, A5E02486680-05
Maximum
40099
MW298
40119
MW298
S7-1200 Programmable controller