User`s manual
100
FX3U Series Programmable Controllers
User’s Manual - MODBUS Serial Communication Edition
11 Practical Program Examples
11.1 Setting Program for Master Station
11. Practical Program Examples
This chapter gives practical program examples of how FX MODBUS Serial Communication can be used.
11.1 Setting Program for Master Station
The FX MODBUS Master station can be used to execute a sequence of MODBUS commands in a cycle as
shown in the following program. The following program example reads coils, reads holding registers, writes
coils, and writes to registers repeatedly while using an Error Handling routine.
M8411
MOV
H1081 D8400
MOV
H1 D8401
MOV
H1 D8415
MOV
K100 D8416
0
Program for setting up a MODBUS Master
For more details on the Communication Setup
Parameters, refer to Section 5.2 of this manual.
Read Discrete Inputs Command
Command Complete Processing
When Error Flag is OFF, move bit data
values into Y0- Y3
M8000
ADPRW
M8029
H1 H2 K0 K4 M100
MOV
K1M100 K1Y000
M8402
CALL P0
M8402
SET M0
M100 M103M102M101
M0
ADPRW
M8029
H4 H1 K0 K32 M1000
CALL P0
RST M0
M8402
SET M1
Read Coils Commamd
Command Complete Processing
When Error Flag is ON, call Error Handing
Routine
Reset Read Coil Command
Set Next Command in Sequence
When Error Flag is ON, call Error Handling
Routine
Start Command Sequence