Attribute: qualified_only
The effect of this pragma is that variables of a global variable list are addressed only 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'}
Insert location: Line above VAR_GLOBAL
in a GVL
Example 289. 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;