Bus cycle task - EtherCAT

General information

As a rule, for each IEC task the used input data is read at the start of each task (1) and the written output data is transferred to the I/O driver at the end of the task (3). The implementation in the I/O driver is decisive for further transfer of the I/O data. The implementation is therefore responsible for the timeframe and the specific time when the actual transmission occurs on the respective bus system.

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). In this task, the messages are normally transferred on the bus.

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.

../_images/59427c4fbfc72cd8c0a8640e01dfe4c12
(1) Read inputs from input buffer       (2) IEC task
(3) Write outputs to output buffer      (4) Bus cycle
(5) Input buffer                        (6) Output buffer
(7) Copy data to/from bus
(9) Bus cycle task, priority 1, 1 ms
(10) Bus cycle task, priority 5
(11) Bus cycle task, priority 10, interrupted by task 5

Using Tasks

The Task deployment 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.

When the same inputs are used in various tasks, the input could change when a task is processed. This happens if the task is interrupted by a task with a higher priority and causes the process map to be read again. Solution: 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.

Behavior of the bus cycle with EtherCAT

The pending network messages of the last cycle are read before the IEC inputs are copied.

../_images/dd2f069dd4393776c0a8640e008cf173

If the Send/Receive per Task option is activated 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. The bus load can thus be reduced.

../_images/e36c2becd4485bedc0a8640e01c3f72a

See also