The implicit enumeration allows for an easy way to declare a new enumeration variable which is valid only within the local POU. A variable of this type can take a limited number of integer values which are declared in the component list.
The implicit enumeration does not have a data type name or identifier.
Declaration:
<variable name> : ( <list of component names> ) := <initialization>;
|
Comma-delimited list of component names with the desired number of components Each component stands for an integer value, starting at 0. The value of the following component is incremented by 1 each time. Example: A fixed value can also be assigned to the components. Example: |
|
Optional Initialization value, usually a component |
Call:
Example
PROGRAM PLC_PRG VAR iAlphabet : (Alfa, Bravo, Charlie, Delta, Echo) := Echo; strText : STRING; iNumber : INT; END_VAR
CASE iAlphabet OF Alfa: strText := 'A'; Bravo: strText := 'B'; Charlie: strText := 'C'; Delta: strText := 'D'; Echo: strText := 'E'; END_CASE iNumber := Alphabet;
-
Internal data type