Skip to main content

Bus Cycle Task – EtherCAT

Behavior at Start

In principle, the input data used for each IEC task is read at the start of the task (_1_r.png) and the output data is written to the I/O driver at the end of the task (_3_r.png). The implementation in the I/O driver is decisive for additional transfer of the I/O data. It determines the time frame and the time when the actual transfer to the corresponding bus system occurs.

The bus cycle task of the PLC can be defined globally for all fieldbuses in the PLC settings. For some fieldbuses, however, you can change this independent of the global setting. The task with the shortest cycle time is used as the bus cycle task (setting: unspecified in the PLC Settings). The messages are normally sent on the bus in this task.

Other tasks copy only the I/O data from an internal buffer that is exchanged only with the physical hardware in the bus cycle task.

Frame at task start

If the FrameAtTaskStart property is set to FALSE, then the timing is as follows:

_ecat_frame_at_task_start_set_false.png

If the FrameAtTaskStart property is set to TRUE, then the timing is as follows:

_ecat_frame_at_task_start_set_true.png
  • _1_r.png Read inputs from input buffer

  • _2_r.png IEC task

  • _3_r.png Writing the outputs in the output buffer

  • _4_r.png Bus cycle

  • _5_r.png Input buffer

  • _6_r.png Output buffer

  • _7_r.png Copy data to/from bus

  • _9_r.png Bus cycle task, priority 1, 1 ms

  • _10_r.png Bus cycle task, priority 5

  • _11_r.png Bus cycle task, priority 10, interrupted by task 5

For more information, see the following: Property: "IoDrvEtherCAT.FrameAtTaskStart"

Task usage

The Task Deployment tab provides an overview of used I/O channels, the set bus cycle task, and the usage of channels.

Warning

If an output is written in various tasks, then the status is undefined, as this can be overwritten in each case.

If the same inputs are used in various tasks, then it is possible for the input to change during the processing of a task. This happens when the task is interrupted by a task with a higher priority and causes the process image to be read again.

Remedy: At the beginning of the IEC task, copy the input variables to variables and then work only with the local variables in the rest of the code.

Conclusion: Using the same inputs and outputs in several tasks does not make any sense and can lead to unexpected reactions in some cases.

For more information, see the following: "Task Configuration" chapter

Behavior of the bus cycle for EtherCAT

Before the IEC inputs are copied, the pending network messages of the last cycle are read.

_ecat_task_diagram11.png

When the Messages per task option is enabled in the settings of the EtherCAT Master, additional telegrams are transmitted to the devices employed per task and input or output employed. Channels that are used in a slow task are also transmitted less frequently. As a result, the bus load can be reduced.

_ecat_img_task_diagram_ethercat2.png