Mitsubishi Electric MELSEC Q Series Programming Manual page 52

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

Advertisement

4 ST PROGRAM EXPRESSIONS
4 - 12
(4) CASE conditional statement
[Format]
CASE <Integer expression> OF
<Integer selection 1> : <Statement 1>
<Integer selection 2> : <Statement 2>
<Integer selection n> : <Statement n>
ELSE
<Statement n+1 ...>
END_CASE;
Specifying method that can be used for <Integer selection *> in
CASE conditional statement
One value, multiple values, or a value range can be specified for <Integer
selection *> in the CASE conditional statement as indicated below.
Example:
1:
2, 3, 4:
(* When the value of the integer expression is any of 2, 3 and 4 *)
5..10:
When ".." is used to specify the range, make the value following ".." greater
than the value preceding "..".
Also, multiple values and range specification can be combined to specify
values.
1, 2..5, 9:
(* When the value of the integer expression is any of 1, 2..5, and 9 *)
Data types that can be used in <integer expression> of CASE
conditional statement
The data types that can be specified as the <integer expression> in the CASE
conditional statement are the integer type (INT) and double precision integer
type (DINT). The word devices and word type or double word type labels can
be specified.
[Explanation]
The result of the expression in the CASE conditional statement is returned
as an integer value. This conditional statement can be used when a
selection statement is executed with a single integer value or the integer
value of the result of a complicated expression, for example.
The statement having the integer selection that matches the value of the
integer expression is executed first, and if there are no matches, the
statement that follows ELSE is executed.
.
.
.
(* When the value of the integer expression is 1 *)
(* When the value of the integer expression is any of 5 to 10 *)
4 - 12

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec l series

Table of Contents