Attribute ‘dataflow’ΒΆ

With this pragma you control the data flow in the processing of function blocks in the FBD/LD/IL editor. The attribute defines the input or output of a function block to which the continuing connection to the next or previous function block is connected.

You may provide only 1 input and 1 output with the attribute in the declaration of a function block.

Syntax:

{attribute 'dataflow'}

Insertion position: line above the line with the declaration of the corresponding variables.

In the case of function blocks without the attribute 'dataflow', CODESYS determines the data flow as follows: first of all the connection is placed between an output and an input of same data type. The highest input or output variable of the function blocks is always taken. If there are no variables of a corresponding data type, CODESYS connects the highest output with the highest input of the neighboring function blocks.

Example

The connection between FB and the preceding function block is established via the input variable i1. The connection between FB and the following function block is established 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