Attention
These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.
P0008¶
- Code
P0008
- Message
Function invocation requires non-formal inputs but the invocation has formal inputs
This error occurs when a function block invocation requires non-formal inputs but the invocation has formal inputs, or when the number of positional arguments doesn’t match the required number.
Example¶
The following code will generate error P0008:
FUNCTION_BLOCK Callee
VAR_INPUT
Input1: BOOL;
Input2: BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK Caller
VAR
FbInstance : Callee;
END_VAR
FbInstance(TRUE); (* Error: Only 1 argument provided, but 2 required *)
END_FUNCTION_BLOCK
The function block invocation provides only one positional argument but the function block requires two inputs.
To fix this error, provide the correct number of positional arguments:
FUNCTION_BLOCK Callee
VAR_INPUT
Input1: BOOL;
Input2: BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK Caller
VAR
FbInstance : Callee;
END_VAR
FbInstance(TRUE, FALSE); (* Correct: Two arguments provided *)
END_FUNCTION_BLOCK