Detailed description of application with TwinCAT

Process data

After reading/manual insertion in the System Manager, the EL2252 appears as follows (Fig. Default representation of the EL2252):

Detailed description of application with TwinCAT 1:
Default representation of the EL2252

Description of the process data

Detailed description of application with TwinCAT 2:

Data type with 64 bit width

A data type with a width of 64 bit is defined in TcEthercat.lib as T_DCTIME or in TcUtilities.lib as T_LARGE_INTEGER.

The process data of the EL2252 can be extended with an input variable representing the local distributed clock time in this EL2252. To this end select the bottom option, i.e. “Inputs” (SM3), in the “Process Data” tab of the EL2252 in the “Sync Manager” field. In the “PDO Assignment” field below, the entry 0x1A00 can now be activated (Fig. Activation of the input variable SysTime). After reloading of the configuration (F4 key) or start in config mode distributed clock time of the EL2252 is now cyclically displayed as SysTime under the process data.

Detailed description of application with TwinCAT 3:
Activation of the SysTime input variable
Detailed description of application with TwinCAT 4:

EL2252-0000-0018

If TwinCAT is configured offline with the EL2252-0000-0018 or through scanning a corresponding EL2252, the PDO feedback is also available as a byte. This can be used to control the triggering of the switching order (see sample programs).

This SysTime variable can now be linked cyclically as a 64-bit process data with the higher-level controller (Fig. EL2252 process image in full configuration).

Detailed description of application with TwinCAT 5:
EL2252 process image in full configuration

Determining a current distributed clock time

If a PLC cycle requires the current distributed clock time, this can be obtained via an input variable of the EtherCAT master or directly from the EL2252. These methods are basically equivalent, since all local clocks in all slaves maintain the same distributed clock time (within the specified accuracy) based on the distributed clock synchronization within the EtherCAT network.

Detailed description of application with TwinCAT 6:

Functions for data types with 64-bit width

A selection of functions for handling 64-bit numbers is available under Beckhoff TwinCAT in the TcUtilities.lib library. Longer execution times are required here than is the case with standard, 32-bit data types.
A data type with a width of 64 bit is defined in TcEthercat.lib as T_DCTIME or in TcUtilities.lib as T_LARGE_INTEGER.

Transfer from EL2252: The SysTime process data has to activated in the EL2252 as specified above and can then be linked with the PLC. The value can also be obtained from another EtherCAT slave that makes its local distributed clock time available as a process data, e.g. an EL1252.

Transfer from the EtherCAT master: The EtherCAT master can display a copy of the current master distributed clock. To this end activate the setting "Show DC System Time (64 bit)" in the EtherCAT device --> EtherCAT tab --> Advanced Settings --> Distributed Clocks (Fig. Activation of the master distributed clock display).

Detailed description of application with TwinCAT 7:
Activation of the master distributed clock display

The process image of the EtherCAT master now looks as shown in Fig. Extended process image of the EtherCAT master:

Detailed description of application with TwinCAT 8:
Extended process image of the EtherCAT master
Detailed description of application with TwinCAT 9:

SYSTIME

The SysTime value of a terminal or the DcSysTime value of an EtherCAT master should be used advisedly and only as a rough guideline for the current time range (order of magnitude: 1-2 task cycles) of the distributed clock system.
This is due to the fact that the local time in the terminal is read into associated buffers several µs before retrieving frame. The EtherCAT strand then requires some time for transporting the process data to the master. The accuracy of the online display in the TwinCAT System Manager (see Fig. Extended process image of the EtherCAT master) is in the 3-figure millisecond range at best due to the visualization character. Within a PLC the SysTime process data may also be outdated to a certain degree: depending on when the analysis takes place in the program code, the process data may be several µs/ms older. If responses of an EtherCAT strand (e.g. an EL2252 output terminal) are to be based on a SysTime read in this way, 2-3 PLC cycles should be taken into account as a buffer. It is more appropriate to use an EL2252 with other EtherCAT slaves that generate a time stamp based on ambient influences, such as the EL1252.

Calculation of the required output time

Detailed description of application with TwinCAT 10:

Functions for data types with 64-bit width

A selection of functions for handling 64-bit numbers is available under Beckhoff TwinCAT in the TcUtilities.lib library. Longer execution times are required here than is the case with standard, 32-bit data types. A data type with a width of 64 bit is defined in TcEthercat.lib as T_DCTIME or in TcUtilities.lib as T_LARGE_INTEGER.

The switching time of the EL2252 must be at least 2 task cycles in the future, because otherwise the process data sequence cannot be adhered to.

Process data transfer sequence

The process data of the EL2252 have to be transferred in two cycles:

Cycle n: StartTime based on calculation, Activate = 0 and output bits Output/Tristate based on target state

Cycle n+1: Activate = 3

Cycle n+2 and following: Activate = 3 and output bits to be held until the target state is reached. A new switching time with associated target state can then be transferred.

Sample Program

A sample program demonstrates the use of EL2252 and EL1252 for outputting pulses. It includes a version with feedback and version without feedback.