Delta AH500 Programming Manual page 477

Hide thumbs Also See for AH500:
Table of Contents

Advertisement

API
Instruction code
1301
NEXT
Symbol:
Explanation:
1.
The program between FOR and NEXT is executed N times. After the program between FOR
and NEXT is executed N times, the program follows NEXT is executed. The instruction FOR
specifies the number of times the program between FOR and NEXT is executed.
2.
N should be within the range between 1 and 32,767. If N is less than 1, it is count as 1.
3.
If the program between FOR and NEXT is not executed, it can be skipped by the use of the
instruction CJ.
4.
The following conditions result in errors.
The instruction NEXT is prior to the instruction FOR.
The instruction FOR exists, but the instruction NEXT does not exist.
The instruction NEXT follows the instruction FEND or END.
The number of times the instruction FOR is used is different from the number of times the
instruction NEXT is used.
5.
FOR/NEXT supports the nested program structure. There are at most 32 levels of nested
program structures. If the loop is executed many times, it takes more time for the program in
the PLC to be scanned, and the watchdog timer error will occur. Users can use the instruction
WDT to resolve the problem.
Example 1:
After program A is executed three times, the program follows the instruction NEXT is executed.
Program B is executed four times every time program is executed. Therefore, program B is
executed twelve times in total.
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Operand
Pulse instruction 16-bit instruction (1 step) 32-bit instruction
Function
End of the nested loop
AH500
6 - 3 0 9

Advertisement

Table of Contents
loading

Table of Contents