Attribute 'dataflow'
The pragma can be used to control the data flow during processing of function blocks in the FBD/LD/IL editor. The attribute determines at which input or output of a function block the next or previous function block is connected.
You can only assign the attribute to one input and one output in the declaration of a function block.
Syntax: {attribute 'dataflow'}
Insertion location: Line above the declaration line of a variable.
For function blocks without the 'dataflow' attribute, TwinCAT determines the data flow as follows: First, the connection between an output and an input of the same data type is placed. The first input or output variable of the function block is always used first. If there are no variables with the same data type, TwinCAT connects the uppermost output to the uppermost input of the neighboring function blocks.
Example:
The connection between FB and the preceding function block is made via the input variable i1. The connection between FB and the subsequent function block is made via 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
See also: