The IEC 61131-3 ST CASE statement executes a block of statements based on a selector value. The CASE statement has this syntax:
CASE selector OF label[,label]: statement; label: statement; label: statement; ELSE statement; END_CASE;
Where:
The ELSE clause is optional.
You can use a range of values for the case labels. For example 0..3: is equivalent to 0,1,2,3:.
(* Translate the pump state into a text string *) CASE PumpState OF 0: StateDescription := "Stopped"; 1: StateDescription := "Running"; 2: StateDescription := "Failed"; ELSE StateDescription := "Invalid"; END_CASE;
IEC 61131-3 Second Edition: Table 56.5.
IEC 61131-3 Third Edition: Table 72.5.
For other Structured Text (ST) statement types.
To learn about expressions that can be used as selector and label values.
For the meaning of terms used in Fernhill SCADA.