Attention

These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.

P0009

Code

P0009

Message

Function invocation assigns output that is not an output variable of the function

This error occurs when a function block invocation assigns an output that is not an output variable of the function block.

Example

The following code will generate error P0009:

FUNCTION_BLOCK Callee
VAR_OUTPUT
    Output1: BOOL;
END_VAR
END_FUNCTION_BLOCK

FUNCTION_BLOCK Caller
VAR
    FbInstance : Callee;
    InvalidOutput : BOOL;
END_VAR
FbInstance(Output1 => InvalidOutput);  (* Error: InvalidOutput not an output *)
END_FUNCTION_BLOCK

The function block invocation tries to assign to InvalidOutput which is not defined as an output variable of the Callee function block.

To fix this error, use only the defined output variables:

FUNCTION_BLOCK Callee
VAR_OUTPUT
    Output1: BOOL;
END_VAR
END_FUNCTION_BLOCK

FUNCTION_BLOCK Caller
VAR
    FbInstance : Callee;
    ValidOutput : BOOL;
END_VAR
FbInstance(Output1 => ValidOutput);  (* Correct: Output1 is defined as output *)
END_FUNCTION_BLOCK