P4102

Code

P4102

Message

Call argument with no value requires choosing a dialect or –allow-omitted-call-argument flag

This error occurs when a call has an argument with no value (b :=, for an input or Error=> , for an output) without the --allow-omitted-call-argument compiler flag.

The IEC 61131-3 standard grammar (Annex B) gives every formal argument a value (name := expression) or a variable (name => variable). Writing the name and the operator with nothing after them, which TwinCAT uses for an unconnected parameter, is an extension. It is the same as leaving the argument out.

Example

The following code will generate error P4102:

PROGRAM main
VAR
    drive : FB_Drive;
END_VAR
    drive(Enable := TRUE, Position :=, Error => );
END_PROGRAM

To fix this error, either leave the arguments out:

PROGRAM main
VAR
    drive : FB_Drive;
END_VAR
    drive(Enable := TRUE);
END_PROGRAM

Or enable the extension:

Pass the --allow-omitted-call-argument flag to enable it, or select a dialect that includes it. See Enabling Dialects and Features for the dialects and flags reference.

Think IronPLC is wrong about this?

If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.