Priority Between Motion and PLC

The Motion computation is always executed each cycle, and occurs before executing the PLCClosed"Programmable Logic Controller" A Programmable Logic Controller, PLC, or Programmable Controller is a digital computer used for automation of industrial processes, such as control of machinery on factory assembly lines. Used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events programs application. The figure below shows the execution in the following order:

  1. Motion command, position feedback from each axis, and other elements in the EtherCATClosed***EtherCAT is an open, high-performance Ethernet-based fieldbus system. The development goal of EtherCAT was to apply Ethernet to automation applications which require short data update times (also called cycle times) with low communication jitter (for synchronization purposes) and low hardware costs PDOClosedPDO is a type of protocol frame used in some fieldbuses. A PDO contains one or more object dictionary entries, which define the application data transferred between devices. object are sent and received on the EtherCAT motion bus (this includes servo drives and Remote I/O)
  2. Motion engines are executed
  3. I/O related to the PLC program are serviced (for more details, EtherCAT Processing Time)
  4. PLC programs are executed
  5. NVRAMClosed"Non-volatile random access memory" NVRAM is the general name used to describe any type of random access memory which does not lose its information when power is turned off. This is in contrast to the most common forms of random access memory today, which both require continual power in order to maintain their data. NVRAM is a subgroup of the more general class of non-volatile memory types, the difference being that NVRAM devices offer random access, like hard disks. The best-known form of NVRAM memory today is flash memory variables are saved (for more details, NVRAM Processing Time)

Figure 5-65: Priority Between Motion and PLC


  • The Motion time (see figure above) must be shorter than the basic cycle duration at each cycle. This condition is checked at each cycle and if the cycle is overran, Kollmorgen Automation Suite generates a fatal error and the application execution is stopped.

EtherCAT Processing Time

The EtherCAT frame is executed at the beginning of the cycle. During this period, all the values related to EtherCAT (PDO) are exchanged, including:

  • Inputs are read
  • Outputs are set

Based on the I/O mapping to PLC variables, the I/Os are updated before they are effectively used during the PLC period.

As a consequence, when the PLC variables set an Output, it is updated during the EtherCAT frame of the next cycle.

About Variation during the EtherCAT Processing

The EtherCAT period is subject to time variation along the cycles due to the following reasons:

  • Some EtherCAT function blocks are using the asynchronous SDO communication, which is not deterministic.
  • Some EtherCAT slave devices support mailbox protocols.
    The master cyclically reads the mailbox of the EtherCAT slaves (polling of mailbox is performed every 50 cycles and is spread on several cycles depending on the number of EtherCAT slaves)

See also the FAQ about SDO communication.

NVRAM Processing Time

Due to a slow processing when saving the Retain Variables to the NVRAM, this action is not performed each cycle. The save operation is performed in the background every 20 seconds (frequency increases to each 2 seconds when the application is running).

When executed during a cycle, it occurs after the PLC period.

What happens when a PLC Program is overrunning the Cycle Duration

Large application can require more than one cycle to completely execute all the PLC programs.

Figure 5-66: Application Overrunning the Basic Cycle

The figure above shows an example of an application with two PLC programs (A and B). It takes two cycles to execute all the code in the two programs.

  • Cycle 1 executes most of Prog. A
  • Cycle 2 finishes Prog. A and executes Prog. B, which is set to run with a cycle period of every other cycle.
  • Cycle 3 starts executing Prog. A again

  • Even if there is time left over in the cycle, execution of Prog. A does not start until the next cycle

An application overrun has no effect other than a short delay in the application execution. Execution of the real-time application is recovered as soon as the overload disappears.


  • If Outputs are set when a program runs over several basic cycles, unexpected and potentially dangerous effects can happen.


  • When running with the KAS Simulator, there is no overrunning because the cycle is extended to include all the PLC programs, right after the Motion computation.

See Also: Priority Between PLC Programs