EasyManua.ls Logo

Omron NJ501-1500

Omron NJ501-1500
990 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2-77
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Sequence Control Instructions
2
FOR and NEXT
The FOR and NEXT instructions repeat the processing that you place between them. (FOR and
END_FOR are used in ST.) The processing procedure for a FOR-NEXT loop is as follows:
1
The value of InitVal is set in control variable Index.
2
The value of Index is checked to see if it is equal to or greater than InitVal and equal to or less
than EndVal (or equal to or greater than EndVal and equal to or less than InitVal). If it is, the pro-
cess moves to step 3. If it is not, repeat processing is ended and the next instruction after the
NEXT instruction (or the END_FOR instruction in ST) is moved to.
3
The processing between the FOR instruction and the NEXT instruction (or the END_FOR
instruction in ST) is executed once.
4
The value of StepVal is added to Index.
5
The process returns to step 2.
The following example is for when InitVal is INT#0, EndVal is INT#9, and StepVal is INT#1. The MOVE
instruction is executed 10 times and INT#0 is assigned to array variables AryOut[0] to AryOut[9].
Execute a BREAK instruction (or an EXIT instruction in ST) to cancel repeat processing. The pro-
cessing between the BREAK instruction and the NEXT instruction will not be executed.
The value of StepVal can be negative. The value of InitVal can be larger than the value of EndVal.
Function
Additional Information
FOR position:=INT#0 TO INT#9 BY INT#1 DO
AryOut[position]:=INT#0;
END_FOR;
LD ST
INT#0
AryOut[position]
INT#0
INT#9
INT#1
position
FOR
EN ENO
InitVal Index
EndVal
StepVal
NEXT
EN ENO
MOVE
EN ENO
In Out

Table of Contents

Related product manuals