76
Modbus RTU control (RS-485 communication)
11.3.3 Diagnosis (08h)
This function code is used to diagnose the communication between the master and slave. Arbitrary data is sent and the
result of returned data is used to determine whether the communication is normal. 00h (reply to query) is the only sub-
function.
Example of diagnosis
Send arbitrary data (1234h) to the slave for diagnosis.
z
Query
Field name Data Description
Slave address 03h Slave address 3
Function code 08h Diagnosis
Data
Sub-function code (upper) 00h
Return the query data
Sub-function code (lower) 00h
Data value (upper) 12h
Arbitrary data (1234h)
Data value (lower) 34h
Error check (lower) ECh
Calculation result of CRC-16
Error check (upper) 9Eh
z
Response
Field name Data Description
Slave address 03h Same as query
Function code 08h Same as query
Data
Register address (upper) 00h
Same as query
Register address (lower) 00h
Data value (upper) 12h
Same as query
Data value (lower) 34h
Error check (lower) ECh
Calculation result of CRC-16
Error check (upper) 9Eh
11.3.4 Writing to multiple holding registers (10h)
This function code is used to write data to multiple successive registers. Up to 123 registers can be written. Make sure
the register value is a multiple of 2.
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 specied range, etc., other data may have been written properly.
Example of write
Set the following data to the "Torque limiting value" in the operation data Nos. 0 to 3 of the slave address 4.
Using the indirect reference function can set multiple items in consecutive addresses.
Description Register address
Value write
Corresponding hexadecimal Corresponding decimal
Torque limiting value of operation data No.0 (upper) 1792 (0700h) 0000h
200
Torque limiting value of operation data No.0 (lower) 1793 (0701h) 00C8h
Torque limiting value of operation data No.1 (upper) 1794 (0702h) 0000h
100
Torque limiting value of operation data No.1 (lower) 1795 (0703h) 0064h
Torque limiting value of operation data No.2 (upper) 1796 (0704h) 0000h
20
Torque limiting value of operation data No.2 (lower) 1797 (0705h) 0014h
Torque limiting value of operation data No.3 (upper) 1798 (0706h) 0000h
50
Torque limiting value of operation data No.3 (lower) 1799 (0707h) 0032h