142
D320 PLC User's Manual
Block Processing Instruction Details
Instruction
Mnemonic
FOR-NEXT Loop
Range
Bit
■
Word
FOR
DFOR
NEXT
FOR (DFOR): Start loop
NEXT: End loop
■
Double words
Ladder
FOR: Begin execution of instructions between (D)FOR and
corresponding NEXT. Repeat execution D times.
NEXT: Decrease D of FOR instruction by 1. If not zero, repeat from FOR
instruction.
Description
1. The FOR/NEXT instructions are used to perform a block of instructions inside a ladder
program repeatedly. The parameter D of the FOR instruction is a value indicating how many
times the block of instructions is to be performed.
2. Branch instructions such as JMP and CALL can be made inside the FOR/NEXT loop.
3. The number of loops to execute (D value) can be changed inside of the FOR/NEXT loop. This
can be used to dynamically increase or decrease the number of loops performed while
processing the loops.
4. If the D register is 0 before the FOR instruction, the instructions between the FOR and NEXT
instructions will NOT be executed. Instead, the program will jump directly to the instruction
following the NEXT.
5. As the FOR/NEXT loop occurs within a single program scan, a large value of D will lengthen
the scan time of the program considerably.
6. This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
FOR
D =
LLL
LLL
LLL
NEXT
R
Summary of Contents for D320 PLC
Page 1: ...D320 PLC User s Manual...
Page 18: ...6 D320 PLC User s Manual...
Page 28: ...16 D320 PLC User s Manual...
Page 34: ...22 D320 PLC User s Manual...
Page 78: ...66 D320 PLC User s Manual...
Page 176: ...164 D320 PLC User s Manual...
Page 210: ...198 D320 PLC User s Manual...
Page 258: ...246 D320 PLC User s Manual...