![background image](http://html1.mh-extra.com/html/omron/sysmac-cx-programmer-9/sysmac-cx-programmer-9_operation-manual_744241181.webp)
155
Statement Descriptions
Section 5-5
■
Processing Flow Chart
■
Usage
Use the FOR statement when the number of iterations has been determined
beforehand. FOR is particularly useful when switching the number of ele-
ments in an array variable according to the value of a specified iteration vari-
able.
■
Description
When the
iteration_variable
is the
initial_value
, the
expression
is executed.
After execution, the value obtained from the
increment_equation
is added to
the
iteration_variable
, and if the
iteration_variable
<
final_value_equation
(see
note 1), the
expression
is executed. After execution, the value obtained from
the
increment_equation
is added to the
iteration_variable
, and if the
iteration_variable
<
final_value_equation
value (see note 1), the
expression
is
executed. This process is repeated.
If the
iteration_variable
≥
final_value_equation
(see note 2), the processing
ends.
Note
(1) If the value from the
increment_equation
is negative, the condition is
iteration_variable
>
final_value_equation
value.
(2) If the value from the
increment_equation
is negative, the condition is
iteration_variable
≤
final_value_equation.
■
Precautions
• A negative value can be specified in the
increment_equation
• FOR must be used in combination with END_FOR.
• The
initial_value
,
final_value_equation
, and
final_value_equation
must be
an integer data type (INT, DINT, LINT, UINT, UDINT, or ULINT).
• After processing is executed with the final value, the iteration value is
incremented to the final value + 1 and iteration processing ends.
Example: In the following structured text, the value of “
a”
becomes TRUE.
Iteration variable = Initial
True
False
Expression
End
Iteration
Iteration va Increment value
Iteration
variable
≥
Final value?
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......