Using enums

Use the following syntax in order to uniquely address a named value within an editor (e.g. within an ST-editor): name_1#name_e1 (with name_1 being the name of the enum and name_e1 being the name of the element) – example: TrafficLight#Red
images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg logi.cals recommends to address named values always with the unique name. This will help to avoid later conflicts when modifying the application – because e.g. a named value is also used in a newly installed library.

However, if logi.CAD 3 is able to derive the named value uniquely from the context, it is possible to only enter the named value. See examples Yellow and Green in the following example (for this example, a declaration as specified under " Declaration of a data type with named values (enums) in ST " is required).

Example: usage
VAR
Var1 : TrafficLight;
Var2 : STRING[20];
END_VAR
 
IF Var1 = TrafficLight#Red THEN (* OK because of the unique access *)
Var2 := 'STOP';
END_IF;
 
IF Var1 = Yellow THEN (* OK because 'Var1' is the context for 'Yellow'; but recommended is the usage of the unique name 'TrafficLight#Yellow' *)
Var2 := 'BEWARE';
END_IF;
 
IF Var1 = Green THEN (* OK although 'Green' is not unique but 'Var1' is the context; but recommended is the usage of the unique name 'TrafficLight#Green' *)
Var2 := 'WALK';
END_IF;
 
IF Var1 = 16#00000000 THEN (* OK because other values than the named values are allowed *)
Var2 := 'No traffic light';
END_IF;

Depending on your logi.CAD 3 c onfiguration (i.e., the start option lc3.expensive.enum.resolving.enable ), you might be able to specify a named value without a unique name – even though the context is not known. However, the named value must be unique. Please mind that the performance might decrease when saving, importing and opening objects and/or projects. If you are interested in changing the current configuration, contact your system integrator and clarify the possible effects of this start option .