Mitsubishi Electric MELSEC Q Series Programming Manual page 79

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

Advertisement

IF ...ELSIF conditional syntax
■Format
IF <Boolean expression 1> THEN
<Syntax 1 ...>;
ELSIF <Boolean expression 2> THEN
<Syntax 2 ...>;
ELSIF <Boolean expression 3> THEN
<Syntax 3 ...>;
END_IF;
■Description
Syntax 1 is executed when the value of Boolean expression (conditional expression) 1 is TRUE. Syntax 2 is executed when
the value of Boolean expression 1 is FALSE and the value of Boolean expression 2 is TRUE.
Syntax 3 is executed when the value of Boolean expression 1 and 2 are FALSE and the value of Boolean expression 3 is
TRUE.
■Example
IF bool1 THEN
intV1 := intV1 + 1;
ELSIF bool2 THEN
intV2 := intV2 + 2;
ELSIF bool3 THEN
intV3 := intV3 + 3;
END_IF;
CASE conditional syntax
■Format
CASE <Integer expression> OF
<Integer selection 1> : <Syntax 1 ...>;
<Integer selection 2> : <Syntax 2 ...>;
<Integer selection n> : <Syntax n ...>;
ELSE
<Syntax n+1 ...>;
END_CASE;
■Description
The result of the CASE conditional expression is returned as an integer value. The CASE conditional syntax is used to
execute a selection syntax by a single integer value or an integer value as the result of a complicated expression.
When the syntax that has the integer selection value that matches with the value of integer expression is executed, and if no
integer selection value is matched with the expression value, the syntax that follows the ELSE syntax is executed.
■Example
CASE intV1 OF
1:bool1 := TRUE;
2:bool2 := TRUE;
ELSE
intV1 := intV1 + 1;
END_CASE;
5 WRITING PROGRAMS
5.1 ST
5
77

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec f seriesMelsec l series

Table of Contents