Attention

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

P4006

Code

P4006

Message

Program task configuration reference not defined

This error occurs when a program configuration references a task that is not defined in the resource.

Example

The following code will generate error P4006:

CONFIGURATION config
    RESOURCE res ON PLC
       PROGRAM plc_task_instance WITH plc_task : main;  (* Error: plc_task not defined *)
    END_RESOURCE
END_CONFIGURATION

The program plc_task_instance references a task named plc_task, but this task is not defined in the resource.

To fix this error, define the task before referencing it:

CONFIGURATION config
    RESOURCE res ON PLC
       TASK plc_task(INTERVAL := T#100ms, PRIORITY := 1);  (* Define the task *)
       PROGRAM plc_task_instance WITH plc_task : main;  (* Correct: task is now defined *)
    END_RESOURCE
END_CONFIGURATION