EasyManua.ls Logo

Omron NJ Series - Page 275

Omron NJ Series
668 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
6 Programming
6-88
NJ-series CPU Unit Software User’s Manual (W501)
You can omit the ELSE statement. If it is omitted, nothing is executed when
<condition_expression> is FALSE.
Process Flow Diagram:
Example:
Example 1: A value of 10 is assigned to variable X when the statement A > 0 is TRUE. A value
of 0 is assigned to variable X when the statement A > 0 is FALSE.
Example 2: A value of 10 is assigned to variable X and a value of 20 is assigned to variable Y
when the statements A > 0 and B > 1 are both TRUE. A value of 0 is assigned to
variable X and variable Y when the statements A > 0 and B > 1 are both FALSE.
Example 3: A value of 10 is assigned to variable X when the BOOL variable A is TRUE. A value
of 0 is assigned to variable X when variable A is FALSE.
IF with Multiple Conditions
Overview:
The construct executes the specified statement when a condition is met. If a condition is not met but
another condition is met, another statement is executed. If neither condition is met, another state-
ment is executed.
The following expressions are used to specify whether the condition is met.
TRUE: The condition is met.
FALSE: The condition is not met.
Reserved Words:
IF, THEN, ELSIF, (ELSE), END_IF
Note You can omit ELSE.
IF A>0 THEN
X:=10;
ELSE
X:=0;
END_IF;
IF A>0 AND B>1 THEN
X:=10;Y:=20;
ELSE
X:=0;Y:=0;
END_IF;
IF A THEN X:=10;
ELSE X:=0;
END_IF;
Condition
Statement
FALSE
TRUE

Table of Contents

Other manuals for Omron NJ Series

Related product manuals