Attribute ‘io_function_block’, ‘io_function_block_mapping’ΒΆ

With the 'io_function_block' attribute, you mark a function block in order to prepare it for the assignment to a channel in the I/O mapping of the device configuration. Then it is shown in the Select function block dialog.

With the 'io_function_block_mapping' attribute, you mark a parameter that should be used when mapping the FB to a device channel in this kind of function block. 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, or 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
VAR

See also