Structured Text; If...then - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

IF...THEN

IF bool_expression THEN
<statement>;
END_IF;
Description:
optional
optional
Use IF...THEN to do something if or when specific conditions occur.
Operands:

Structured Text

Operand
Bool_
expression
The syntax is described in the table.
IF bool_expression1 THEN
<statement >;
.
.
.
ELSIF bool_expression2 THEN
<statement>;
.
.
.
ELSE
<statement>;
.
.
.
END_IF;
To use ELSIF or ELSE, follow these guidelines.
1. To select from several possible groups of statements, add one or more
ELSIF statements.
· Each ELSIF represents an alternative path.
· Specify as many ELSIF paths as you need.
· The controller executes the first true IF or ELSIF and skips the rest of
the ELSIFs and the ELSE.
2. To do something when all of the IF or ELSIF conditions are false, add an
ELSE statement.
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Type
Format
BOOL
Tag
expression
Structured Text Programming
Enter
BOOL tag or expression that evaluates to a
BOOL value (BOOL expression)
Statements to execute when
bool_expression1 is true
Statements to execute when
bool_expression2 is true
Statements to execute when both
expressions are false
Appendix C
681

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents