Omron CX-PROGRAMMER V8.1 Operation Manual page 177

Function blocks/ structured text
Table of Contents

Advertisement

Statement Descriptions
CASE Statement
152
• Multiple statements can be executed in expression_@. Be sure to use a
semicolon (;) delimiter between multiple statements in an expression.
• The ELSE statement can be omitted. When ELSE is omitted, no opera-
tion is executed if the result of any condition equation is false.
■ Examples
Example 1: If variable A>0 is true, variable X will be substituted with numerical
value 10.
If A>0 is false, but variable B=1, variable X will be substituted with numerical
value 1.
If A>0 is false, but variable B=2, variable X will be substituted with numerical
value 2.
If either of these conditions is met, variable X will be substituted with numeri-
cal value 0.
IF A>0 THEN X:=10;
ELSIF B=1 THEN X:=1;
ELSIF B=2 THEN X:=2;
ELSE X:=0;
END_IF;
■ Summary
This statement executes an expression containing a selected integer that
matches the value from an integer equation. If the selected integer value is
not the same, either no expression or a specified expression is executed.
■ Reserved Word
CASE
■ Statement Syntax
CASE <integer_equation> OF
<integer_equation_value_1 >:<expression_1>;
<integer_equation_value_2>:<expression_2>;
<integer_equation_value_n>:<expression_n>;
ELSE <expression_m>;
END_CASE;
...
Section 5-5

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac ws02-cxpc1-v8Sysmac cx-programmer 8.1

Table of Contents