Omron SYSMAC CS Series Instruction & Reference Manual page 155

Hide thumbs Also See for SYSMAC CS Series:
Table of Contents

Advertisement

FOR/NEXT
Instruction
---
Symbol
Applicable Program Areas
Function block
Area
definitions
Usage
OK
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
AR
N
OK
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
continues 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.
Note If a loop repeats in one cycle and a differentiated bit is used in the FOR-NEXT loop, that bit will be always ON or always
OFF within that loop.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Mnemonic
Variations
FOR
---
NEXT
---
FOR
FOR(512)
N
N: Number of loops
Block program areas
Step program areas
Not allowed
OK
Description
Indirect DM/EM
@DM
T
C
DM
EM
@EM
OK
OK
OK
OK
Label
ER
• ON if more than 15 loops are nested.
• OFF in all other cases.
=
OFF
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
addresses
Con-
stants
*DM
DR
*EM
OK
OK
OK
OK
Operation
Repeated program section
3. Instructions
Function
NEXT
NEXT(513)
SFC action or
Interrupt tasks
transition programs
OK
OK
Size
1
Registers
Flags
Pulse
bits
Indirect
IR
TK
CF
using IR
---
OK
---
---
Repeated N times
3
TR
bits
---
---
121

Advertisement

Table of Contents
loading

Table of Contents