7 Instructions
CASE instruction
The CASE instruction combines several conditional instructions. It consists of an expression that con-
tains an integer variable and a list of instruction groups. Each group is identified by a mark consisting of
one or more integers (separated by commas). The value of the variable determines the mark and thus
the instruction group to be executed. The keyword ELSE can also be used as an option. If no value ap-
plies, the instruction group following the keyword ELSE is executed.
Keywords:
CASE, OF, ELSE, END_CASE
Example:
VAR
b1: BOOL;
b2: BOOL;
END_VAR
CASE i OF (* variable i must be UINT or UDINT *)
1: b1 := TRUE;
2, 3, 4: b2 := TRUE;
ELSE
b1 := FALSE;
b2 := FALSE;
END_CASE;
32