P4078

Code

P4078

Message

Task INTERVAL is negative

This error occurs when a TASK declares a negative INTERVAL. The interval of a cyclic task is the time between the starts of two runs, so it cannot be less than zero.

Example

The following code will generate error P4078:

CONFIGURATION config
    RESOURCE resource1 ON PLC
        TASK task1(INTERVAL := T#-10ms, PRIORITY := 1);
        PROGRAM instance1 WITH task1 : main;
    END_RESOURCE
END_CONFIGURATION

To fix this error, give the task a positive interval:

CONFIGURATION config
    RESOURCE resource1 ON PLC
        TASK task1(INTERVAL := T#10ms, PRIORITY := 1);
        PROGRAM instance1 WITH task1 : main;
    END_RESOURCE
END_CONFIGURATION

A task with an interval of zero, or with no INTERVAL, runs freewheeling: the runtime starts the next scan cycle as soon as the previous one finishes.

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.