FOR-NEXT Repetition
FOR-NEXT Repetition: FOR, NEXT
Instruction | Device address | No. of Steps | Flag | |||||||||||||||
M | X | Y | K | L | F | T | C | S | Z | D | @D | Int. | Error | Zero | Carry | |||
FOR | S | o | o | o | o | o | o | o | o | - | o | o | o | o | 2 | o | - | - |
NEXT | S | - | - | - | - | - | - | - | - | - | - | - | - | - | 1 |
n | Repeat Count for FOR and NEXT (1 ~ 32767). |
Error (F110) | Occurs when a device is assigned to @D and the device range limit exceeds. |
Functions
Repeats the instructions between the FOR and the NEXT for the designated number of times.
The repeat count (n) can be assigned to one of the numbers from 1 to 32767.
When the repeat count (n) number is from -32767 to 0, this instruction is operated as n=1.
The nesting for the FOR instruction is possible up to 16 times.
Example)
When M01 is turned OFF, the FOR-NEXT instruction is executed.
When M01 is turned ON, the FOR-NEXT instruction is NOT executed.