7. APPLICATION INSTRUCTIONS
7
−
89
MELSEC-A
(4) Up to five levels of the nesting of FOR is allowed.
Operation Errors
In the following cases, operation occurs and the PC stops its operation.
•
After the execution of FOR instruction, the END (FEND) instruction has been
executed before the NEXT instruction is executed.
•
The NEXT instruction has been executed before the FOR instruction is executed.
•
The number of the FOR instructions is different from that of the NEXT
instructions.
•
The JMP instruction is executed in the FOR to NEXT processing to exit from the
FOR to NEXT processing.
•
There is a STOP instruction in the FOR to NEXT processing.
Program Example FOR
,
NEXT
Program which executes the FOR to NEXT instructions when X8 is off and does not
execute the FOR to NEXT instructions when X8 is on.
NEXT
NEXT
NEXT
X000
X001
X002
Up to five levels of the
nesting of FOR is allowed.
K
FOR
5
K
FOR
3
K
FOR
100
(
)
X008
M0
M0
0
4
10
13
22
23
P8
CJ P8
K
FOR 4
INC Z
MOV Z
D0
MOV 0
Z
Z
NEXT
Y033
•
Coding
0 LD
X008
1 CJ
P8
4 LDI
M0
5 MOV
K0
Z
10
FOR
K4
13
LDI
M0
14
MOV
Z
D0Z
19
INC
Z
22
NEXT
23
P8
24
LD
X00A
25
OUT
Y033
26
END
X00A
K
Summary of Contents for MELSEC-A series
Page 1: ......
Page 2: ......
Page 13: ...A 11 MEMO...
Page 505: ...APPENDICES APP 100 MELSEC A MEMO...
Page 507: ......
Page 508: ......