2-14 CoDeSys V2.3
<Value2>: <Instruction 2>
<Value3, Value4, Value5>: <Instruction 3>
<Value6 .. Value10>: <Instruction 4>
...
<Value n>: <Instruction n>
ELSE <ELSE instruction>
END_CASE;
CASE instructions are processed according to the following patterns:
If the variable Var1 has the value Value1, then the instruction Instruction1 is executed.
If the variable Var1 is not the specified value, then execute the ELSE Instruction.
If there are multiple variable values to execute the same instruction, then these conditions
execute a common instruction.
If the same instruction is executed within a range of values for a variable, the initial and final
values are separated by two periods, so common conditions can be specified.
Example:
CASE INT1 OF
1, 5: BOOL1 := TRUE;
BOOL3 := FALSE;
2: BOOL2 := FALSE;
BOOL3 := TRUE;
10..20: BOOL1 := TRUE;
BOOL3:= TRUE;
ELSE
BOOL1 := NOT BOOL1;
BOOL2 := BOOL1 OR BOOL2;
END_CASE;
FOR Loop
Through the FOR loop program, it is possible to write processing procedures that are executed
repeatedly.
Sentence:
INT_Var :INT;
FOR <INT_Var> := <INIT_VALUE> TO <END_VALUE> {BY <Step size>} DO
<Instructions>
END_FOR;
Parts within {} are optional.
59
Need help?
Do you have a question about the MAT-LC-C Series and is the answer not in the manual?