Attention
These docs are a bit ambitious. The steps described are accurate but IronPLC cannot yet run programs.
P0006¶
- Code
P0006
- Message
Function call mixes named (formal) and positional (non-format) input arguments
This error occurs when a function block invocation mixes named (formal) and positional (non-formal) input arguments.
Example¶
The following code will generate error P0006:
FUNCTION_BLOCK Callee
VAR_INPUT
Input1: BOOL;
Input2: BOOL;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK Caller
VAR
FbInstance : Callee;
END_VAR
FbInstance(Input1 := TRUE, FALSE); (* Error: Mixed formal and non-formal arguments *)
END_FUNCTION_BLOCK
The function block invocation mixes named input Input1 := TRUE with positional input FALSE, which is not allowed.
To fix this error, use either all named or all 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(Input1 := TRUE, Input2 := FALSE); (* Correct: All named arguments *)
END_FUNCTION_BLOCK