105BCommunication processor
12.5 Modbus communication
S7-1200 Programmable controller
610
System Manual, 11/2011, A5E02486680-05
The following table shows examples of Modbus address to holding register mapping that is
used for Modbus function codes 03 (read words), 06 (write word), and 16 (write words). The
actual upper limit of DB addresses is determined by the maximum work memory limit and M
memory limit, for each CPU model.
Table 12- 76 Mapping of Modbus addresses to CPU memory
MB_HOLD_REG parameter examples
Modbus Master
Address
MW100
DB10.DBw0
MW120
DB10.DBW50
"Recipe".ingredient
40001
MW100
DB10.DBW0
MW120
DB10.DBW50
"Recipe".ingredient[1]
40002
MW102
DB10.DBW2
MW122
DB10.DBW52
"Recipe".ingredient[2]
40003
MW104
DB10.DBW4
MW124
DB10.DBW54
"Recipe".ingredient[3]
40004
MW106
DB10.DBW6
MW126
DB10.DBW56
"Recipe".ingredient[4]
40005
MW108
DB10.DBW8
MW128
DB10.DBW58
"Recipe".ingredient[5]
Table 12- 77 Diagnostic functions
S7-1200 MB_SLAVE Modbus diagnostic functions
Codes
Sub-function
Description
08
0000H
Return query data echo test: The MB_SLAVE will echo back to a Modbus master a
word of data that is received.
08
000AH
Clear communication event counter: The MB_SLAVE will clear out the communication
event counter that is used for Modbus function 11.
11
Get communication event counter: The MB_SLAVE uses an internal communication
event counter for recording the number of successful Modbus read and write requests
that are sent to the Modbus slave. The counter does not increment on any Function 8,
Function 11, or broadcast requests. It is also not incremented on any requests that
result in a communication error (for example, parity or CRC errors).
The MB_SLAVE instruction supports broadcast write requests from any Modbus master as
long as the request is for accessing valid addresses. MB_SLAVE will produce error code
0x8188 for function codes not supported in broadcast.