Attribute hide
The pragma {attribute hide} helps you to prevent variables or even whole signatures from being displayed within the functionality of listing components or the input assistant or the declaration part in online mode. Only the variable subsequent to the pragma will be hidden.
If you know the instance path to a variable, you can address it in the code even if the {attribute hide} is assigned.
{attribute 'hide'}
To hide all local variables of a signature, use the attribute hide_all_locals.
The function block myPOU is implemented using the attribute:
FUNCTION_BLOCK myPOU
VAR_INPUT
a:INT;
{attribute 'hide'}
a_invisible: BOOL;
a_visible: BOOL;
END_VAR
VAR_OUTPUT
b:INT;
END_VAR
In the main program 2 instances of function block myPOU are defined:
PROGRAM PLC_PRG
VAR
POU1, POU2: myPOU;
END_VAR
When assigning an input value to POU1
, the functionality of listing components that works on typing POU1
in the implementation part of PLC_PRG
will display the input variables a
and a_visible
(and the output variable b
). The hidden input variable a_invisible
will not be displayed.