Case; Structured Text - 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

Appendix C
Structured Text Programming
CASE...OF
CASE numeric_expression OF
selector1: statement;
selectorN: statement;
ELSE
statement;
Description:
Specify as many alternative
selector values (paths) as
you need.
optional
684
Use CASE to select what to do based on a numerical value.
Operands:

Structured Text

Operand
Numeric_
expression
Selector
IMPORTANT
The syntax is described in the table.
CASE numeric_expression OF
selector1 : <statement>;
selector2 : <statement>;
selector3 : <statement>;
ELSE
END_CASE;
See the table on
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Type
Format
SINT
Tag
INT
expression
DINT
REAL
SINT
Immediate
INT
DINT
REAL
If you use REAL values, use a range of values for a selector
because a REAL value is more likely to be within a range of
values than an exact match of one, specific value.
.
.
.
.
.
.
.
.
.
<statement>;
.
.
.
page 686
for valid selector values.
Enter
Tag or expression that evaluates to a number
(numeric expression)
Same type as numeric_expression
Statements to execute when
numeric_expression = selector1
Statements to execute when
numeric_expression = selector2
Statements to execute when
numeric_expression = selector3
Statements to execute when
numeric_expression ≠ any selector

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents