Omron NJ-series User Manual page 275

Machine automation controller cpu unit software
Hide thumbs Also See for NJ-series:
Table of Contents

Advertisement

6 Programming
• You can omit the ELSE statement. If it is omitted, nothing is executed when
<condition_expression> is FALSE.
Process Flow Diagram:
Condition
TRUE
Statement
Example:
Example 1:
IF A>0 THEN
ELSE
END_IF;
Example 2:
IF A>0 AND B>1 THEN
ELSE
END_IF;
Example 3:
IF A THEN X:=10;
ELSE X:=0;
END_IF;
 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.
6-88
FALSE
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.
X:=10;
X:=0;
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.
X:=10;Y:=20;
X:=0;Y:=0;
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.
NJ-series CPU Unit Software User's Manual (W501)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents