If <Condition> Then; Else; End_If; Process Flow Diagram - Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual

Function blocks
Table of Contents

Advertisement

Structured Text (ST Language) Specifications
Example:
IF <condition_1> THEN
IF <condition_2> THEN
<expression_1>;

ELSE

<expression_2>:

END_IF;

END_IF;
The processing flow diagram is as follows:

False

Condition 1

True

False
Condition 2
True

Expression 1

Expression 1
ELSE corresponds to THEN immediately before it, as shown in the above diagram.
• Multiple statements can be executed within expression_1 and expression_2. Be sure to use a semicolon (;)
delimiter between multiple statements in an expression.
• The ELSE statement can be omitted. When ELSE is omitted, no operation is executed if the result of the
condition equation is false.
Processing Flow Diagram
False
Condition
True
Expression
Examples
Example 1: If variable A>0 is true, variable X will be substituted with numerical value 10. If A>0 is false, variable
X will be substituted with numerical value 0.
IF A>0 THEN
X:=10;
ELSE
X:=0;
END_IF;
Example 2: If variable A>0 and variable B>1 are both true, variable X will be substituted with numerical value
10, and variable Y will be substituted with numerical value 20. If variable A>0 and variable B>1 are both false,
variable X and variable Y will both be substituted with numerical value 0.
146
Appendix B

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

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

Table of Contents

Save PDF