Mitsubishi Electric MELSEC Q Series Programming Manual page 56

Structured text
Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

4 ST PROGRAM EXPRESSIONS
4 - 16
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.
Repeat variable
initialization
FALSE
Repeat variable
Statement
Repeat variable +
incremental value
[Description example]
(a) When actual device is used in repeat variable
FOR W1 : = 0
TO 100
BY 1 D0
W3 : = W3 + 1; (* During repeat processing, W3 is incremented by 1. *)
END_FOR;
last value?
TRUE
(* W1 is initialized with 0.
(* Processing is repeated until W1 reaches 100.
(* W1 is incremented by 1.
*)
*)
*)
4 - 16

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec l series

Table of Contents