The pragma {attribute 'dataflow'} enables you to control the dataflow when processing function blocks in the FBD/LD/IL editor. The attribute defines the input or output of a function block that is used as the connection to the next or previous function block.
You can assign this attribute to only one input and one output in the declaration of the function block.
For function blocks without the {attribute 'dataflow'}, the dataflow is determined automatically as follows:
The connection is established between an output and an input of the same type. The uppermost input and output variables of the function block are used first. If there are no variables with the same data type, then the uppermost output is connected to the uppermost input of the next function block.
You can also change the control flow in the editor by using the pointer to connect the connector pins of the function block to other positions. For further information, refer to the description of Inserting, Arranging, and Replacing Elements.
{attribute 'dataflow'}
The FB and the previous function block are connected using the input variable i1. The FB and the next function block are connected using the output variable outRes1.
FUNCTION_BLOCK FB
VAR_INPUT
r1 : REAL;
{attribute 'dataflow'}
i1 : INT;
i2 : INT;
r2 : REAL;
END_VAR
VAR_OUTPUT
{attribute 'dataflow'}
outRes1 : REAL;
out1 : INT;
g1 : INT;
g2 : REAL;
END_VAR