Omron CP1E-E@@D@-@ Computer Hardware User Manual


 
2 Instructions
2-56
CP1E CPU Unit Instructions Reference Manual(W483)
FOR/NEXT
Applicable Program Areas
Operands
N: Number of loops
The number of loops must be 0000 to FFFF (0 to 65,535 decimal).
Operand Specifications
Flags
Function
Instruction Mnemonic Variations
Function
code
Function
---
FOR --- 512
The instructions between FOR(512) and
NEXT(513) are repeated a specified number of
times.
NEXT --- 513
Symbol
FOR NEXT
Area Step program areas Subroutines Interrupt tasks
Usage --- OK OK
Operand Description Data type Size
N Number of loops UINT 1
Area
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits
CIO WR HR AR T C DM @DM *DM
N OKOKOKOKOKOKOK OK OK OK --- --- ---
Name Label Operation
Error Flag P_ER ON if more than 15 loops are nested.
OFF in all other cases.
Equals Flag P_EQ OFF
Negative Flag P_N OFF
The instructions between FOR(512) and NEXT(513)
are executed N times and then program execution con-
tinues with the instruction after NEXT(513). The
BREAK(514) instruction can be used to cancel the
loop.
If N is set to 0, the instructions between FOR(512) and
NEXT(513) are processed as NOP(000) instructions.
Loops can be used to process tables of data with a
minimum amount of programming.
FOR(512)
N
N: Number of loops
NEXT(513)
Repeated N times
Repeated program section
NEXT
FOR
N