Case instruction, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual
Page 58
L-force | PLC Designer
What is What in PLC Designer
56
DMS 3.2 EN 02/2011 TD29
If the <Boolean_expression1> returns TRUE, then only the <IF_Instructions> are
executed and none of the other instructions.
Otherwise the Boolean expressions, beginning with <Boolean_expression2>, are
evaluated one after the other until one of the expressions returns TRUE. Then only
those instructions after this Boolean expression and before the next ELSE or ELSIF are
evaluated.
If none of the Boolean expressions produce TRUE, then only the <ELSE_instructions>
are evaluated.
Example:
IF temp<17
THEN heating_on := TRUE;
ELSE heating_on := FALSE;
END_IF;
Here the heating is turned on when the temperature sinks below 17 degrees.
Otherwise it remains off.
CASE instruction
With the CASE instructions one can combine several conditioned instructions with the
same condition variable in one construct.
Syntax:
CASE
<Var1> OF
<Value1>: <Instruction 1>
<Value2>: <Instruction 2>
<Value3, Value4, Value5>: <Instruction 3>
<Value6 .. Value10>: <Instruction 4>
...
<Value n>: <Instruction n>
ELSE
<ELSE instruction>
END_CASE;