Usage; Tion) Is Met - Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual

Function blocks
Table of Contents

Advertisement

Structured Text (ST Language) Specifications
IF A>0 AND B>1 THEN
X:=10; Y:=20;
ELSE
X:=0; Y:=0;
END_IF;
Example 3: If the boolean (BOOL data type) variable A=1(ON), variable X will be substituted with numerical
value 10. If variable A=0(OFF), variable X will be substituted with numerical value 0.
IF A THEN X:=10;
ELSE X:=0;
END_IF;
IF Statement (Multiple Conditions)
Summary
This statement is used to execute an expression when a specified condition is met. If the first condition is not
met, but another condition is met, a corresponding expression is executed. If none of the conditions is met, a
different expression is executed.
Reserved Words
IF, THEN, ELSIF, (ELSE)
Note ELSE can be omitted.
Statement Syntax
IF <condition_1> THEN <expression_1>;
ELSIF <condition_2> THEN <expression_2>;
ELSIF <condition_3> THEN <expression_3>;
...
ELSIF <condition_n> THEN <expression_n>;
ELSE <expression_m>;
END_IF;
Processing Flow Chart
False
Condition 1
True
Condition 2
Expression 1
Expression 2
Expression m

Usage

Use the IF statement to perform different operations depending which of multiple conditions (condition equa-

tion) is met.

False
True
False
Condition 3
True
Expression 3
Appendix B
147

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-programmer 5.0Sysmac ws02-cxpc1-e-v50Cs1-hCj1-hCj1m

Table of Contents