For And Next - Omron NY532-5400 Reference Manual

Ny-series
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

2 Instruction Descriptions

FOR and NEXT

FOR:
Marks the starting position for repeat processing and specifies the repeat condition.
NEXT:
Marks the ending position for repeat processing.
Instruction
FOR
Repeat Start
NEXT
Repeat End
Variables
Name
Meaning
InitVal
Initial value
EndVal
End value
StepVal
Increment
Index
Control
variable
*1 When using a ladder diagram, set InitVal so that it is less than EndVal.
*2 If you omit an input parameter, the default value is not applied. A building error will occur.
*3 When using a ladder diagram, 0 and negative numbers are not included. When using an ST program, 0 is not included.
*4 If you omit the input parameter in a ladder diagram, the default value is not applied. A building error will occur. If you omit
the input parameter in ST, a default value of 1 is applied.
Bit strings
InitVal
EndVal
StepVal
Index
* You cannot specify enumerations in ladder diagrams.
2-82
Name
FB/FUN
FUN
FUN
I/O
Description
Value to set the Index to
when repetition is started.
Value of Index where repeti-
Input
tion is stopped
Value to add to Index each
time processing is repeated
Output
Loop index
OK OK OK OK OK OK OK OK
An enumeration, array element or structure member can also be specified.*
OK OK OK OK OK OK OK OK
An array element or structure member can also be specified.
OK OK OK OK OK OK OK OK
An array element or structure member can also be specified.
OK OK OK OK OK OK OK OK
An array element or structure member can also be specified.
Graphic expression
FOR
EN
ENO
InitVal
Index
EndVal
StepVal
NEXT
EN ENO
Valid range
Depends on data
*1
type.
Depends on the data
*3
type.
Depends on data type.
Integers
NY-series Instructions Reference Manual (W560)
ST expression
FOR Index:=InitVal TO End-
Val BY StepVal DO
expression
END_FOR*;
* In ST, do not use NEXT to
mark the ending position
of repeat processing. Use
END_FOR instead.
Unit
Default
*2
---
*4
---
---
Times, durations,
dates, and text strings

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents