Determination of the current Distributed Clock time

If an up-to-date statement of the Distributed Clock time is needed in a PLC cycle, this can be linked via the input variable of the EtherCAT master.

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 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).

Determination of the current Distributed Clock time 1:
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:

Determination of the current Distributed Clock time 2:
Extended process image of the EtherCAT master

SYSTIME

The EtherCAT master value DcSysTime is to be used with care and should serve only as a coarse indication as to which time range (order of magnitude: 1-2 task cycles) the Distributed Clocks system is currently in.
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. Due to the character of the visualization, the online display in the TwinCAT System Manager is accurate at best to a three-figure millisecond range. 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 segment (e.g. an EL2212 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 EL2595 with other EtherCAT slaves that generate a time stamp based on ambient influences, such as the EL1252.
Alternatively, functions can also be called at NC/PLC runtime that immediately return the current DC time, e.g. F_GetCurDcTickTime. Refer to the notes on the TwinCAT time sources in the EtherCAT system documentation.