Attention
IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.
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 allows implicit widening between integer types (for example,
INT to DINT), but rejects other type mismatches such as integer to real or narrowing
conversions.
For the full set of allowed implicit conversions, see Type Conversions.
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));