Attribute: io_function_block, io_function_block_mapping Permalink

The ‎io_function_block‎ attribute has the effect that a function block, which is decorated with it, is available in the device configuration for assignment to a channel in the I/O mapping. The function block is shown in the “Select Function Block” dialog.

The ‎'io_function_block_mapping'‎ attribute has the effect in this kind of function block that a parameter is decorated which is automatically used when mapping the function block to a device channel.

You can provide the attribute to multiple parameters of the function block. For I/O mapping, the first one is used automatically whose type matches the channel (input, output, data type).

Syntax:

‎{attribute 'io_function_block'}‎

‎{attribute 'io_function_block_mapping'}‎

Insert location: The line above the first line in the declaration of the function block, and in the line above the parameter declaration.

Example

{attribute 'io_function_block'}
FUNCTION_BLOCK Scale_Output_Int
VAR_INPUT
    iInput : INT;
    iNumerator : INT;
    iDenominator : INT :=1;
    iOffset : INT := 0;
END_VAR
VAR_OUTPUT
    {attribute 'io_function_block_mapping'}
    iOutput : INT;
END_VAR