Global variables
Topics:
Use attribute 'qualified_only' for GVL
When defining a global variable list or a parameter list use the attribute {attribute 'qualified_only'}, forcing the use of the GVL namespace when using the variables. By using the namespace (e.g.: GVL_Ctrl.bPaintingActive
) the global scope of the variable becomes clear.
Positive sample:
Global variable list "GVL_Ctrl":
{attribute 'qualified_only'}
VAR_GLOBAL
bPaintingActive : BOOL;
END_VAR
Use global variables wisely
To prevent concurrent access and to support data encapsulation, avoid global instantiations if possible.
Likewise, you should avoid using existing global variables within function blocks if possible. You assign necessary data via input parameters.
See also: