For/Next - Omron SYSMAC CP Series Instruction & Reference Manual

Cpu unit
Hide thumbs Also See for SYSMAC CP Series:
Table of Contents

Advertisement

2 Instructions

FOR/NEXT

Instruction
---
Symbol
Applicable Program Areas
Area
Usage
Operands
Operand
N
Number of loops
N: Number of loops
The number of loops must be 0000 to FFFF (0 to 65,535 decimal).
Operand Specifications
Word addresses
Area
CIO
WR
HR
N
OK
OK
OK
Flags
Name
Error Flag
Equals Flag
Negative Flag
Function
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.
2-56
Mnemonic
Variations
FOR
---
NEXT
---
FOR
FOR(512)
N
N: Number of loops
Step program areas
---
Description
AR
T
C
DM
OK
OK
OK
OK
Label
P_ER
• ON if more than 15 loops are nested.
• OFF in all other cases.
P_EQ
OFF
P_N
OFF
Function
code
The instructions between FOR(512) and
512
NEXT(513) are repeated a specified number of
513
times.
Subroutines
OK
Data type
UINT
Indirect DM addresses
Constants
@DM
*DM
OK
OK
OK
Operation
Repeated program section
CP1E CPU Unit Instructions Reference Manual(W483)
Function
NEXT
NEXT(513)
Interrupt tasks
OK
Size
1
CF
Pulse bits
TR bits
---
---
---
FOR
Repeated N times
N
NEXT

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents