Method of control via Modbus protocol
−18−
Writing to multiple holding registers (10h)
This function code is used to write data to multiple successive registers. Up to 16 registers can be written.
Write the data to the upper and lower at the same time. If not, an invalid value may be written.
Registers are written in order of register addresses. Note that even when an exception response is returned
because some data is invalid as being outside the specified range, etc., other data may have been written properly.
Example of write
Set the following data to the acceleration Nos. 0 to 2 in the operation data of slave address 4.
Description
Register address
Value write
Corresponding decimal
Acceleration time No.0 (upper)
0600h
0000h
2
Acceleration time No.0 (lower)
0601h
0002h
Acceleration time No.1 (upper)
0602h
0000h
50
Acceleration time No.1 (lower)
0603h
0032h
Acceleration time No.2 (upper)
0604h
0000h
150
Acceleration time No.2 (lower)
0605h
0096h
•
Query
Field name
Data
Description
Slave address
04h Slave address 4
Function code
10h Writing to multiple holding registers
Data
Register address (upper)
06h
Register address to start writing from
Register address (lower)
00h
Number of registers (upper)
00h Number of registers to be written from the starting register
address (6 registers=0006h)
Number of registers (lower)
06h
Number of data bytes
0Ch Twice the number of registers in the query
(6 registers × 2 = 12 registers: 0Ch)
Value write to register address (upper)
00h
Value written to register address 0600h
Value write to register address (lower)
00h
Value write to register 1 (upper)
00h
Value written to register address 0601h
Value write to register 1 (lower)
02h
Value write to register 2 (upper)
00h
Value written to register address 0602h
Value write to register 2 (lower)
00h
Value write to register 3 (upper)
00h
Value written to register address 0603h
Value write to register 3 (lower)
32h
Value write to register 4 (upper)
00h
Value written to register address 0604h
Value write to register 4 (lower)
00h
Value write to register 5 (upper)
00h
Value written to register address 0605h
Value write to register 5 (lower)
96h
Error check (lower)
85h
Calculation result of CRC-16
Error check (upper)
70h
•
Response
Field name
Data
Description
Slave address
04h Same as query
Function code
10h Same as query
Data
Register address (upper)
06h
Same as query
Register address (lower)
00h
Number of registers (upper)
00h
Same as query
Number of registers (lower)
06h
Error check (lower)
40h
Calculation result of CRC-16
Error check (upper)
D6h