Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 67

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

■ RETURN statement
Control statement
Format
■RETURN
RETURN;
Select statements
Control
Format
statement
■IF THEN
IF<boolean
expression>THEN
<statement>;
END_IF;
■IF...ELSE
IF<boolean
expression>THEN
<statement 1>;
ELSE
<statement 2>;
END_IF;
■IF...ELSEIF
IF<boolean expression
1>THEN
<statement 1>;
ELSEIF<boolean
expression 2>THEN
<statement 2>;
ELSEIF<boolean
expression 3>THEN
<statement 3>;
END_IF;
■CASE
CASE<integer
expression>OF
<selected integer 1>:
<statement 1>;
<selected integer 2>:
<statement 2>;
<selected integer n>:
<statement n>;
ELSE
<statement n+1>;
END_CASE;
Description
The statement is used to terminate a program, function block, or
function during operation.
When the RETURN statement is used in a program, control jumps to
the step next to the last statement in the program.
When the RETURN statement is used in a function block, control
returns from the function block.
When the RETURN statement is used in a function, control returns from
the function.
A single RETURN statement uses one point of the pointer type label in
the system.
Description
The statement is executed if the boolean expression (conditional
formula) is TRUE. The statement is not executed if the boolean
expression is FALSE.
Any expression can be used for the boolean expression if it returns
TRUE or FALSE as the boolean operation result of a single bit variable
expression or a complicated expression including many variables.
Statement 1 is executed if the boolean expression (conditional formula)
is TRUE.
If the boolean expression is FALSE, statement 2 is executed.
Statement 1 is executed if boolean expression 1 (conditional formula) is
TRUE. If boolean expression 1 is FALSE and boolean expression 2 is
TRUE, statement 2 is executed.
If boolean expressions 1 and 2 are FALSE and boolean expression 3 is
TRUE, statement 3 is executed.
The statement that has a selected integer value matching the value of
the integer expression (conditional formula) is executed, and if no
statement has a matching value, the statement following the ELSE
statement is executed.
The CASE statement can be used to execute a select statement
according to a single integer value or the integer value of the result of a
complicated expression.
Example
IF bool1 THEN
RETURN;
END_IF;
Example
IF bool1 THEN
intV1 := intV1 + 1;
END_IF;
IF bool1 THEN
intV3 := intV3 + 1;
ELSE
intV4 := intV4 + 1;
END_IF;
IF bool1 THEN
intV1 := intV1 + 1;
ELSIF bool2 THEN
intV2 := intV2 + 2;
ELSIF bool3 THEN
intV3 := intV3 + 3;
END_IF;
CASE intV1 OF
1:
bool1 := TRUE;
2:
bool2 := TRUE;
ELSE
intV1 := intV1 + 1;
END_CASE;
6 STRUCTURED TEXT LANGUAGE
6.1 Configuration
6
65

Advertisement

Table of Contents
loading

Table of Contents