38
YASKAWA
SIEP C730600 0E YAI Modbus TCP/IP Technical Manual
Examples of Register Write Command
lists command examples when writing register value 0003 (Hex.) to register address 0001 (Hex.) in a
drive with the slave address (unit identifier) 01 (Hex.).
shows examples of responses indicating that the write command has been executed successfully. The
command specifies the value and the register address to write to.
shows examples of an error response when writing to a register. The exception code is 21 (Hex.)
(indicating an invalid value).
Table 7.15 Examples of Register Write Command
Description
Data (Hex.)
Slave Address (Unit Identifier)
01
Function Code
06
Register Address
Upper
00
Lower
01
Register Values
Upper
00
Lower
03
*1
This option is set up to use PLC based (holding) register addressing (base 1). The drive will automatically convert the register
address to one more than the address sent over the network before it will respond.
When writing the register address 0001 (Hex.) from the PLC:
1.
The PLC sends out a command specifying the register address 0000 (Hex.) to the network.
2.
The drive automatically convert the register address 0000 (Hex.) to 0001 (Hex.).
3.
The drive responds the value of register address 0001 (Hex.) to the PLC.
Table 7.16 Example Write Single Register Response
Description
Data (Hex.)
Slave Address (Unit Identifier)
01
Function Code
06
Register Address
Upper
00
Lower
01
Register Values
Upper
00
Lower
03
Table 7.17 Example Write Single Register Error Response
Description
Data (Hex.)
Slave Address (Unit Identifier)
01
Error Code
86
Exception Code
21
16 (10 (Hex.)) Write Multiple Registers
This function code is used to write to a contiguous block of registers in the drive. The command specifies the
starting register address, the number of registers, and the values to be written. The command packs two bytes per
register. For each register in the command, the first byte contains the most significant bits, and the second byte
contains the least significant bits. The normal response returns the function code, starting address, and quantity of
registers written.
Table 7.18 Write Multiple Registers Command
Description
Byte No.
Data (Hex.)
Slave Address (Unit Identifier)
1
00 - FF
Function Code
1
10
Starting Register
2
0000 - FFFF
Quantity of Registers
2
N
Number of Data Bytes
1
N
× 2
Register Values
N
× 2
0000 - FFFF