4 - 16 4 - 16
4 ST PROGRAM EXPRESSIONS
Precaution for use of repeat variable
The double precision integer type (DINT) and integer type (INT) can be used for
a repeat variable, but structure elements and array elements cannot be used.
Also, match the type used for the repeat variable with the types of the <last
value expression> and <incremental expression>.
Precaution for use of incremental expression
The <incremental expression> can be omitted. When omitted, the <incremental
expression> is executed as 1.
When "0" is assigned to the <incremental expression>, the FOR syntax and
later may not be executed or an endless loop may occur.
Precaution for use of FOR ... DO syntax
In the FOR ... DO syntax, the count processing of the repeat variable is
performed after execution of <Statement ...> in the FOR syntax. An endless
loop will occur if the count processing higher than the maximum value or lower
than the minimum value of the data type of the repeat variable is executed.
TRUE
Repeat variable
initialization
FALSE
Repeat variable
last value?
Statement
Repeat va
incremental value
[Description example]
(a) When actual device is used in repeat variable
FOR W1 : = 0
(* W1 is initialized with 0.
*)
TO 100
(* Processing is repeated until W1 reaches 100. *)
BY 1 D0
(* W1 is incremented by 1.
*)
W3 : = W3 + 1; (* During repeat processing, W3 is incremented by 1. *)
END_FOR;
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......