7 Applied Instructions (Program Flow)
7.10 NEXT / End a FOR/NEXT Loop
131
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied Instructions
(Program Flow)
8
Applied Instructions
(Move and
Compare)
9
Applied Instructions
(Arithmetic and
Logical Operation)
10
Applied Instructions
(Rotation and
Shift Operation)
Program examples
1. Program example with three FOR-NEXT loops
X010
P22:
1) 2) 3)
FOR
EN
n
ENO
NEXT
EN ENO
CJ
EN ENO
p
K4
FOR
EN
n
ENO
D0Z
P22
FOR
EN
n
ENO
K1X000
NEXT
EN ENO
NEXT
EN ENO
7 times
6 times
4 times
The loop 3) is repeated 4 times.
When the data value (current value) of D0Z
(D4 when Z is "4") is "6", the loop 2) is
repeated 6 times.
When X010 is OFF
When K1X000 is "7", the loop 1) is repeated 7 times.
When X010 is ON
The program execution jumps to the pointer P22, and
the loop 1) is skipped.
Number of times of repeating the loops 1), 2) and 3).
X010=ONX010=OFF
4 times
1)
2)
3)
0 time
24 times
4 times
7 6 4 = 168 times
6 4 = 24 times