9
Program
9.2. Destination Device Command
The functions to read or write coils or registers are defined as ''Modbus functions'' in
Modbus-RTU communication. The Destination Device can be operated (command execution)
by using the Modbus functions to read or write coils or registers defined by Destination
Device.
9.2.1. Function Code List
In the Modbus functions, a function code is assigned for each function. The following function
codes are available for Destination Device in this document.
This program performs to read "Direct I/O and electromagnetic brake status" by using the
function ''Reading from a holding register(s) (function code: #03)''.
#03
Reading from a
holding register(s)
This function code is used to read a register (16 bits).
Up to 16 successive registers (16×16 bits) can be read.
Read the upper and lower data at the same time.
If they are not read at the same time, the value may be
#06
Writing to a
holding register
This function code is used to write data to a specified
register address.
However, since the result combining the upper and
lower may be outside the data range, write the upper
and lower at the same time using "Writing to multiple
holding registers (#10)".
#08 Diagnosis
This function code is used to diagnose the
communication between the master and slave.
Arbitrary data is sent and the returned data is used to
determine whether the communication is normal.
#10
Writing to multiple
holding registers
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.
For details on function codes, refer to Function code in Method of control via Modbus
RTU(RS-485 communication) of the Brushless Motor and Driver Package BLE Series FLEX
RS-485 communication type USER MANUAL (HM-5140).