Attribute 'is_connected'

The 'is_connected' pragma is used to identify a Boolean function block variable that provides information on whether the assigned input of the function block receives an assignment when a function block instance is called.

The application of the pragma presupposes that the attribute 'reflection' is applied to the affected function block.

Syntax: {attribute 'is_connected' := '<input variable>'}

Insertion location: Line above the declaration of the individual Boolean function block variables

Sample:

In the function block FB a local variable is declared for each input variable (nIn1 and nIn2), and this is preceded by the attribute 'is connected' with specification of the input variable. The function block itself is assigned the pragma attribute 'reflection'.

When an instance of the function block is called, the local variable becomes TRUE if the input assigned to it has received an assignment.

{attribute 'reflection'}
FUNCTION_BLOCK FB_Sample
VAR_INPUT
    nIn1: INT;
    nIn2: INT;
END_VAR
VAR
    {attribute 'is_connected' := 'nIn1'}
    bIn1Connected: BOOL;
    {attribute 'is_connected' := 'nIn2'}
    bIn2Connected: BOOL;
END_VAR

Assumption: nIn1 receives an assignment from outside when the function block instance is called; nIn 2 receives no assignment at this time. The following code is created:

bIn1Connected := TRUE;
bIn2Connected := FALSE;