2-6
UR FAMILY – COMMUNICATIONS GUIDE
MODBUS FUNCTION CODES
CHAPTER 2: MODBUS COMMUNICATION
2
Table 2-8: Master and slave device packet transmission example
2.2.5 Store multiple settings (function code 10h)
This function code allows the master to modify the contents of a one or more consecutive setting registers in a relay.
Setting registers are 16-bit (two byte) values transmitted high order byte first. The maximum number of setting registers
that can be stored in a single packet is 123. The following table shows the format of the master and slave packets in
Modbus RTU. Modbus TCP/IP ADUs have a MBAP instead of slave address, and CRC is in another stack layer. The example
shows a master device storing the value 200 at memory map address 4051h, and the value 1 at memory map address
4052h to slave device 11h (17 decimal).
Table 2-9: Master and slave device packet transmission example
2.2.6 Exception responses
Programming or operation errors usually happen because of illegal data in a packet. These errors result in an exception
response from the slave. The slave detecting one of these errors sends a response packet to the master with the high order
bit of the function code set to 1.
The following table shows the format of the master and slave packets in Modbus RTU. Modbus TCP/IP ADUs have a MBAP
instead of slave address, and CRC is in another stack layer. The example shows a master device sending the unsupported
function code 39h to slave device 11h.
Master transmission
Slave response
Packet format
Example (Hex)
Packet format
Example (Hex)
SLAVE ADDRESS
11
SLAVE ADDRESS
11
FUNCTION CODE
06
FUNCTION CODE
06
DATA STARTING ADDRESS - high
40
DATA STARTING ADDRESS - high
40
DATA STARTING ADDRESS - low
51
DATA STARTING ADDRESS - low
51
DATA - high
00
DATA - high
00
DATA - low
C8
DATA - low
C8
CRC - low
CE
CRC - low
CE
CRC - high
DD
CRC - high
DD
Master transmission
Slave response
Packet format
Example (Hex)
Packet format
Example (Hex)
SLAVE ADDRESS
11
SLAVE ADDRESS
11
FUNCTION CODE
10
FUNCTION CODE
10
DATA STARTING ADDRESS - hi
40
DATA STARTING ADDRESS - hi
40
DATA STARTING ADDRESS - lo
51
DATA STARTING ADDRESS - lo
51
NUMBER OF SETTINGS - hi
00
NUMBER OF SETTINGS - hi
00
NUMBER OF SETTINGS - lo
02
NUMBER OF SETTINGS - lo
02
BYTE COUNT
04
CRC - lo
07
DATA #1 - high order byte
00
CRC - hi
64
DATA #1 - low order byte
C8
DATA #2 - high order byte
00
DATA #2 - low order byte
01
CRC - low order byte
12
CRC - high order byte
62