Skip to main content

Data Type: Implicit Enumeration

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>;

<list of component names>

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: Alfa, Bravo, Charlie, Delta, Echo

A fixed value can also be assigned to the components.

Example: Zero, Alfa:=10, Bravo:=20, Charlie:=30, Delta:=40, Echo

<initialization>

Optional

Initialization value, usually a component

Call:

Example 103. 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 := iAlphabet;


Internal data type

With an implicit enumeration, a data type is created internally whose name follows the following scheme:

IMPLICIT_ENUM_ <POU name> _ <variable name>

However, you should not use this internal identifier because it is always possible that the internal identifier is different.