Attention
These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.
P0007¶
- Code
P0007
- Message
Function invocation assigns named (formal) input that is not defined
This error occurs when a function block invocation assigns a named (formal) input that is not defined in the function block.
Example¶
The following code will generate error P0007:
FUNCTION_BLOCK Callee
VAR_INPUT
Input1: BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK Caller
VAR
FbInstance : Callee;
END_VAR
FbInstance(InvalidInput := TRUE); (* Error: InvalidInput not defined *)
END_FUNCTION_BLOCK
The function block invocation references InvalidInput which is not defined in the Callee function block.
To fix this error, use only the defined input names:
FUNCTION_BLOCK Callee
VAR_INPUT
Input1: BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK Caller
VAR
FbInstance : Callee;
END_VAR
FbInstance(Input1 := TRUE); (* Correct: Input1 is defined *)
END_FUNCTION_BLOCK