300
4
4 Instructions4.11.1 Communication Instructions
MODBUS: Modbus communication
◆
Overview
The MODBUS instruction reads and writes data during Modbus communication.
MODBUS S1 S2 n D
Modbus
communication
Applicable model:
H3U
S1
Communication
address and
parameter number
Slave address (higher byte) and communication command
(lower byte, dened in the Modbus protocol)
16-bit instruction (9
steps)
MODBUS:
Continuous
execution
S2
Slave data head
address
Head address of slave registers that store the data to be
accessed
n Data length Length of the data to be read or written
D
Master data head
address
Head address of units that store the read or written data (The
length of occupied address units is determined by n.)
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S1 X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
S2 X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
n X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
For more intuitive and convenient operation, the RS instruction can be replaced with the MODBUS
instruction during communication through a standard Modbus master station protocol.
ǒMODBUS D0 D1 D2 D10Ǔ
X1
M8002
ǒMOV H81 D8120Ǔ
ǒMOV H20 D8126Ǔ
Modbus-RTU selected
S1 nS2 D
Example 1:
M8002
ǒMOV H081 D8120Ǔ
ǒMOV H20 D8126Ǔ
ǒMODBUS H0103 K100 K1 D10Ǔ
COM1 set to 9600, in 8N1 communication format and
half-duplex mode
COM1 set to Modbus-RTU
Communication timeout time set to 100 ms
Placed in the first line
of the program
ǒMOV K10 D8129Ǔ
M8000
Slave
address: 01;
command
code: 03
Register
head
address:
K100
Read data
length:
One
segment
Head
address of
received
data storage