Skip to main content

Compiler Error C0227

Message: Initialisation of constant variable <constant name> not constant

Possible error cause: A constant is initialized with a variable.

Error correction: Initialize constants only with constant values.

Example 447. Example of the error:
PROGRAM PLC_PRG
VAR
    i : INT;
END_VAR
VAR CONSTANT
    k : INT := i;
END_VAR

Message:

C0227: Initialisation of constant variable 'k' not constant