3. Instruction Set
Program Example 3: COM2 (RS-485), Function Code H03 (The function code H04 is the same
as the function code H03.)
1. Function code K3 (H03): read multiple Word devices. Up to 16 words can be read. For COM2
ASCII mode, only 8 words can be read.
2. For ASCII or RTU mode, PLC COM2 stores the data to be sent in D1256~D1295, converts the
received data in registers starting from S, and stores the converted 16-bit data in D1296 ~
D1311.
3. Take the connection between PLC (PLC COM2) and VFD-B for example, the tables below
explains the status when PLC reads status of VFD-B. (M1143 = OFF, ASCII Mode) (M1143
= ON, RTU Mode)
H87
MOV
M1002
D1120
SET
M1120
K100
MOV
D1129
RST
M1127
Set communication protocol as 9600, 8, E, 1
Retain communication protocol
Set communication timeout as 100ms
MODRW K3K1
X0
H2100 D0 K6
Connection device
address: K1
Function code: K3
read multiple words
Data address: H2100
Data storing register
Data length(word)
Processing received data
ASCII mode : The received ASCII data is stored in registers starting from D0
and PLC converts the ASCII data to Hex value and stores them in
D1296~D1301 automatically.
RTU mode : The received data is stored in registers starting from D0 in Hex value.
Reset M1127
M1127
SET
X0
M1122
Sending request
M1143 = OFF
ASCII mode
RST
M1143
M1143 = ON
RTU mode
SET
M1143
Receiving completed
ASCII mode (M1143 = OFF):
When X0 = ON, MODRW instruction executes the function specified by Function Code 03
PLC VFD-B, PLC sends: “01 03 2100 0006 D5”
VFD-B PLC, PLC receives: “01 03 0C 0100 1766 0000 0000 0136 0000 3B”
Registers for data to be sent (sending messages)