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):
Description of the process data
- Activate
This byte activates a new start time in the terminal through the transition 0 --> 3 - StartTime
64-bit value of the next desired switching event - Output
Output 0 V/24 V of channel 1 or 2 - Tristate
Switch channel 1 or 2 to high-resistance - WcState operational information
Each datagram of the EL2252 indicates its processing state here. This allows the EL2252 to be monitored for correct process data communication. - State operational information
Status display of the “EtherCAT state machine - SysTime
64 bit system time, read out of the terminal. Available since revision 0016.
The PDO system time can’t be transferred simultaneously with the PDO Feedback. Generally it’s recommended to determine the current system time via an alternative way, e.g. by the EtherCAT Master or dedicated Function Blocks (FB) of the EtherCAT library (Tc2_EtherCAT.lib). - Feedback
1 byte feedback contains the current output state (output and tristate) of the terminal. Available since revision 0018.
The PDO Feedback can’t be transferred simultaneously with the PDO system time.
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.
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).
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.
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. |
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).
The process image of the EtherCAT master now looks as shown in Fig. Extended process image of the EtherCAT master:
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. |
Calculation of the required output time
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.