Attention
IronPLC implements many parts of the IEC 61131-3 standard and is working toward full Structured Text support. Key features still missing include arrays and structures. Try it out in the IronPLC Playground.
P4026¶
- Code
P4026
- Message
Function call argument type does not match parameter type
This error occurs when a function call passes an argument whose type does not match the declared parameter type. IronPLC requires exact type matching for user-defined function arguments.
Example¶
The following code will generate error P4026:
FUNCTION DOUBLE_REAL : REAL
VAR_INPUT
A : REAL;
END_VAR
DOUBLE_REAL := A + A;
END_FUNCTION
PROGRAM main
VAR
result : REAL;
x : INT;
END_VAR
result := DOUBLE_REAL(x); (* Error: INT argument for REAL parameter *)
END_PROGRAM
The variable x is INT, but parameter A expects REAL.
To fix this error, use an explicit type conversion:
result := DOUBLE_REAL(INT_TO_REAL(x));