Loop Begin (FOR)
Instruction Parameters
Supported PLC Series
| XPnA/1R | XPnB | XPnE | XPnF | CP3A/B/P/U CP4A~D/U | CPnE | CPnF | BP | PLC-S |
|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| n | ✓ | ✓ | ✓ | ✓ | ✓ | - | ✓ | ✓ | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | - |
| Carry | F11.2 | - |
Number of Steps
| Steps |
|---|
| 1 |
Operands
| Operand | Description |
|---|---|
| n | The only operand. Entries are WORD data registers or constants. This is the number of times to repeat the instructions inside the loop statement. The value range is 1 ~ 32,767 (215-1). |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.
- Compile errors occur under the following conditions:
- When the value of n exceeds the range 1 ~ 32,767 (215-1).
- When the FOR ~ NEXT instructions are not used as a pair.
- When the FOR ~ NEXT instructions exceed 16 levels.
Instruction Behavior
The FOR instruction behaves as follows:
Excessive Use
If the FOR ~ NEXT instructions are used excessively, the scan time increases.
The system might be overloaded causing the CPU to shut down or initialize.