Timing of task running
A diagram showing the running of PLC tasks.
The PLC tasks are shown from the top in the order of priority, which is the order in which running is assigned in the case of simultaneous occurrence. The image shows the tasks in bright colour when they are effectively running their code and in light colour when, once the run start condition has been reached, they are waiting to start or are suspended due to the pre-emption of tasks of higher priority.As you might guess, tasks with a higher priority are more likely to run their tasks more regularly; on the other hand, their running generates slow-downs and delays in tasks with a lower priority.It is therefore necessary to find the right balance during programming to guarantee the regular running of all the tasks, properly distributing the tasks in consideration of the running frequency required and the cost in terms of time.The diagram also shows a brief representation of occupation by other non-PLC tasks of the UPC time. These tasks, which can be communication, HMI tasks, etc., have higher priority than the BACKGROUND, which is activated only when no other task is working, involving a part which would otherwise be the system idle time.You can also see that for FAST tasks (correctly, being periodical) and for NORMAL and SLOW tasks (improperly, being cyclic), the run time (T) is shown; in particular, the period is indicated for NORMAL and SLOW by the theoretic initial moment, this being the only one certain and not subject to delays and jitter induced by tasks with a higher priority. Vice versa for the BACKGROUND task, there is a delta (dt), which is calculated from the moment of final execution of the task.