Attribute qualified_only
When the pragma {attribute 'qualified_only'}
is assigned on top of a global variable list, the variables of this list can only be accessed by using the global variable name, for example gvl.g_var
. This works even for variables of enumeration type. It can be useful to avoid name mismatch with local variables.
Assume the following global variable list (GVL) is provided with attribute 'qualified_only'
:
{attribute 'qualified_only'}
VAR_GLOBAL
iVar:INT;
END_VAR
Within POU PLC_PRG
, the global variable has to be called with the prefix GVL
, as shown in this example:
GVL.iVar:=5;
The following incomplete call of the variable will be detected as an error:
iVar:=5;