Attention

IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.

P0002

Code

P0002

Message

Syntax error

This error occurs when there is a syntax error in the Structured Text code that prevents the parser from understanding the program structure.

Example

The following code will generate error P0002:

FUNCTION_BLOCK CounterLD
VAR_INPUT
    Reset : BOOL  (* Error: Missing semicolon *)
END_VAR
VAR_OUTPUT
    Out : INT;
END_VAR
END_FUNCTION_BLOCK

The function block declaration is missing a semicolon after the input variable declaration.

To fix this error, add the missing semicolon:

FUNCTION_BLOCK CounterLD
VAR_INPUT
    Reset : BOOL;  (* Correct: Semicolon added *)
END_VAR
VAR_OUTPUT
    Out : INT;
END_VAR
END_FUNCTION_BLOCK