Skip to main content

Attribute: hide_all_locals

The pragma prevents all local variables of a signature from being visible in the display of the "List components" function, in the Input Assistant or in the declaration part in online mode. Moreover, these variables are hidden in the symbol configuration and therefore cannot be exported as symbols. The pragma is especially useful in library POUs to hide POU variables from users.

. Affected features
  • Library management

  • Debugging

  • Input Assistant

  • "List components" Feature

  • Monitoring

  • Symbol Configuration

Syntax:

{attribute 'hide_all_locals'}

Insert location: First line above the declaration part of the POU

Example 270. example

The function block FB_MyB uses the attribute:

{attribute 'hide_all_locals'}
FUNCTION_BLOCK FB_MyB
VAR_INPUT
        iInB : INT;
        {attribute 'hide'}
        xInvisibleIn : BOOL;
        xInit: BOOL;
END_VAR
VAR_OUTPUT
        iOutB : INT;
END_VAR
VAR
        iCounter : INT;
        xVar : BOOL;
END_VAR

Two instances of the function block FB_MyB are defined in the main program.

PROGRAM PLC_PRG
VAR
        fbMyB1, fbMyB2: FB_MyB;
        iVar3: INT;
        iVar4: INT;
END_VAR

fbMyB1(iInB := 2, xInvisibleIn := TRUE, iOutB => iVar3);
fbMyB2(iInB := 2, iOutB => iVar4);
IF fbMyB2.iCounter > 100 THEN
        fbMyB2.xInit := TRUE;
END_IF

Now when you download the program to the controller, start it, and switch to online mode, the variables iInB, xInit, iOutB, and xReset are displayed in the declaration editor. However, the hidden local variables iCounter and xVar are not displayed.