Attribute ‘qualified_only’¶
The effect of this pragma is that variables of a global variable list are only addressed by specifying the global variable name, for example gvl.g_var
. This also applies to variables of the type Enumeration and can be helpful in avoiding being mistaken for local variables.
Syntax:
{attribute ‘qualified_only’}
Insertion position: line above VAR_GLOBAL
in a GVL
Example
Global Variable List GVL:
{attribute 'qualified_only'}
VAR_GLOBAL
iVar:INT;
END_VAR
Within a POU, for example PLC_PRG, the global variable iVar
can only be addressed using the prefix GVL
:
GVL.iVar:=5;
Conversely, the following incomplete call of the variable will create an error:
iVar:=5;