Omron CX-PROGRAMMER V8.1 Operation Manual page 176

Function blocks/ structured text
Table of Contents

Advertisement

Statement Descriptions
Note
Statement Syntax
Processing Flow Chart
ELSE can be omitted.
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;
False
Condition 1
True
Condition 2
Expression 1
True
Expression 2
Expression m
■ Usage
Use the IF statement to perform different operations depending which of mul-
tiple conditions (condition equation) is met.
■ Description
Condition 1 = If true, execute expression 1
Condition 1 = If false,
Condition 2 = If true, execute expression 2
Condition 2 = If false,
Condition 3 = If true, execute expression 3
etc.
Condition n = If true, execute expression n
If none of these conditions are met, condition m is executed.
■ Precautions
• IF must be used together with END_IF.
• Condition_@ contains the true or false result of the equation (e.g.,
IF(A>10)).
A boolean (BOOL data type) variable only can also be specified as the
condition rather than an equation. For boolean conditions, the result is
true when the variable value is 1 (ON) and false when it is 0 (OFF).
• Statements that can be used in expression_@ are assignment state-
ments, IF, CASE, FOR, WHILE, or REPEAT.
...
False
False
Condition 3
True
Expression 3
Section 5-5
151

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