For-Next Loop Statements - Hitachi SJ700-2 Series Instruction Manual

Easy-sequence programming software ezsq
Hide thumbs Also See for SJ700-2 Series:
Table of Contents

Advertisement

Chapter 5 Instruction Words

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> is executed and <variable> incremented by <incremental value>
from <start value>. If <variable> reaches or exceeds <end value>, processing exits the loop. Otherwise,
the loop process is repeated. Therefore, <instruction set> is always executed at least once.
The following chart shows the flow of processing.
<variable>:
<start value>:
<end value>:
<incremental value>: Specifies the value to be added to <variable> each time the loop is executed. You
<instruction set>:
for loop instruction
This loop instruction executes <instruction set> repeatedly until
<variable> reaches <end value>.
Note that <variable>, which initially contains <start value>, is
incremented by <incremental value> each time <instruction set> is
executed.
Assign <start value> in <variable>
Assign "<start value> + <incremental
No
Specifies the name of the variable to be used for the loop.
Specifies the initial value of <variable> to be applied at the beginning of the loop.
You can specify a 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 <start value>.
Specifies the limit value at which to exit the loop. Processing exits the loop when
<variable> reaches or exceeds <end value>. You can specify a 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>.
can specify a 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
<incremental value>.
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.
Description
Execute <instruction set>
value>" to <variable>
Did
<variable> reach <end
value>?
Yes
5 - 8

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sj700 series

Table of Contents