Allen-Bradley LOGIX 5000 Reference Manual page 524

Controllers advanced process control and drives and equipment phase and sequence instructions
Hide thumbs Also See for LOGIX 5000:
Table of Contents

Advertisement

Chapter 10
Structured Text Programming
524
Multiple, distinct values
A range of values
Distinct values plus a range of values valuea, valueb, value1..valueN : <statement>
The CASE construct is similar to a switch statement in the C or C++
programming languages. With the CASE construct, the controller executes only
the statements that associated with the first matching selector value. Execution
always breaks after the statements of that selector and goes to the END_CASE
statement.
Affects Math Status Flags
No
Major/Minor Faults
None
Example
If you want this
If recipe number = 1 then Ingredient A outlet 1 = open (1) Ingredient B
outlet 4 = open (1)
If recipe number = 2 or 3 then
Ingredient A outlet 4 = open (1)
Ingredient B outlet 2 = open (1)
If recipe number = 4, 5, 6, or 7 then Ingredient A outlet 4 = open (1)
Ingredient B outlet 2 = open (1)
If recipe number = 8, 11, 12, or 13 then Ingredient A outlet 1 = open (1)
Ingredient B outlet 4 = open (1)
Otherwise all outlets = closed (0)
The [:=] tells the controller to also clear the outlet tags whenever the controller
does the following:
Rockwell Automation Publication 1756-RM006K-EN-P - November 2018
value1, value2, valueN : <statement>
Use a comma (,) to separate each value.
value1..valueN : <statement>
Use two periods (..) to identify the range.
Enter this structured text
CASE recipe_number OF
1:
Ingredient_A.Outlet_1 :=1;
Ingredient_B.Outlet_4 :=1;
2,3:
Ingredient_A.Outlet_4 :=1;
Ingredient_B.Outlet_2 :=1;
4 to 7: Ingredient_A.Outlet_4 :=1;
Ingredient_B.Outlet_2 :=1;
8,11...13
Ingredient_A.Outlet_1 :=1;
Ingredient_B.Outlet_4 :=1;
ELSE
Ingredient_A.Outlet_1 [:=]0;
Ingredient_A.Outlet_4 [:=]0;
Ingredient_B.Outlet_2 [:=]0;
Ingredient_B.Outlet_4 [:=]0;
END_CASE;

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents