This instruction allows a group of instructions to be selected for execution depending on the value of a variable.
Syntax |
|
|
var |
Variable that depending on its value selects which instruction group to execute |
|
const |
Its value is the numerical identifier of the instruction group. It must be an integer numeric constant, otherwise an alarm is generated at compilation |
|
Validity |
Rule, Task |
|
Note |
"Instruction group" means those instructions that are between the case identifier and the next break, or between the default identifier and the end_select identifier (if the default identifier is present). It is possible to have multiple case identifiers associated with the same break; this means that if an instruction group is not terminated by break, subsequent instructions will also execute until the first break (or end_select identifier). If the variable value does not satisfy any of the specified cases (i.e., it does not match any of the cost values associated with the case identifiers), the instructions in the default group are executed. This block can be omitted, and in that case no instruction is executed |
Example of use with state machine:
|