For-Next Loop Statements - Hitachi NT2021XA Instruction Manual

Easy-sequence programming software
Table of Contents

Advertisement

for-next loop statements

- Format
Format
for
<variable> <start value> <end value>
<incremental value>
<instruction set>
next
- Explanation
Use the for loop statement to effectively describe a process for which the number of execution times is predetermined.
As a loop process,
<instruction set>
If
<variable>
exceeds
<end
<instruction set>
is always executed at least once.
The following chart shows the flow of processing.
<variable>
:
Specifies the name of the variable to be used for the loop.
<start value>
:
Specifies the initial value of
variable name or immediate value (i.e., a value that can be entered directly). The immediate value must
be an integer ranging from 0 to 127. To use a larger numerical value, preset the value in a variable and
specify the variable as
<end value>
:
Specifies the limit value at which to exit the loop. Processing exits the loop when
<end
directly). The immediate value must be an integer ranging from 0 to 127. To use a larger numerical
value, preset the value in a variable and specify the variable as
<incremental value>
: Specifies the value to be added to
variable name or immediate value (i.e., a value that can be entered directly). The immediate value must
be an integer ranging from 0 to 127. To use a larger numerical value, preset the value in a variable and
specify the variable as
<instruction set>
:
Describes the set of instructions to be executed in one loop process. The instructions may be
described on two or more lines. The instructions are executed in units of lines in a cycle as explained
below.
for loop instruction
This loop instruction executes
<variable>
Note that <variable>, which initially contains
incremented by
set>
is executed and
<variable>
value>, processing exits the loop. Otherwise, the loop process is repeated. Therefore,
Assign
<start value>
Execute
<instruction set>
Assign
"<start value>
<incremental
value>" to
No
<variable>
<end
<variable>
<start
value>.
value>. You can specify a variable name or immediate value (i.e., a value that can be entered
<incremental
Description
exceeds
<end
value>.
<incremental value>
is executed.
incremented by
<incremental value>
in
<variable>
+
<variable>
Did
exceed
value>?
Yes
to be applied at the beginning of the loop. You can specify a
<variable>
each time the loop is executed. You can specify a
value>.
2-11
Chapter 2 Syntax
<instruction set>
repeatedly until
<start
value>, is
each time
<instruction
from
<start
<variable>
<end
value>.
value>.
exceeds

Advertisement

Table of Contents
loading

Table of Contents