Chapter 5 Instruction Words
5 - 8
for-next loop statements
for loop instruction
- Format
Format Description
for <variable> <start value> <end
value> [<incremental value>]
<instruction set>
next
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.
- 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.
Assign <start value> in <variable>
Execute <instruction set>
Assign "<start value> + <incremental
value>" to <variable>
Did
<variable> reach <end
value>?
No
Yes
<variable>:
Specifies the name of the variable to be used for the loop.
<start value>:
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>.
<end 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>.
<incremental value>: Specifies the value to be added to <variable> each time the loop is executed. 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
<incremental value>.
<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.
Содержание SJ700 Series Software
Страница 8: ...Contents vii ...
Страница 10: ......
Страница 16: ...Chapter 1 Introduction 1 6 ...
Страница 18: ......
Страница 24: ...Chapter 2 Creation and Execution of a User Program 2 6 ...
Страница 26: ......
Страница 30: ...Chapter 3 Syntax 3 4 ...
Страница 32: ......
Страница 54: ......
Страница 102: ......
Страница 110: ...Chapter 6 Interface with the Inverter 6 8 ...
Страница 112: ......
Страница 115: ...Chapter 8 Appendix 8 1 Inverter Parameters and Available Settings 8 1 ...
Страница 116: ......