Sample programs

Sample programs 1:

Using the example programs

This document contains sample applications of our products for certain areas of application. The application notices provided here are based on typical features of our products and only serve as samples. The notices contained in this document explicitly do not refer to specific applications. The customer is therefore responsible for assessing and deciding whether the product is suitable for a particular application. We accept no responsibility for the completeness and correctness of the source code contained in this document. We reserve the right to modify the content of this document at any time and accept no responsibility for errors and missing information.

Diagnostics and time-stamping of analog input data 

Sample programs 2:Download (example file)

In this example the input data of an EL3702 will be checked for validity and processed:

Connection diagram:

Sample programs 3:
Connection for sample program

Starting the example program

The application samples have been tested with a test configuration and are described accordingly.
Certain deviations when setting up actual applications are possible.

The following hardware and software were used for the test configuration:

Procedure for starting the program

Sample programs 4:
Searching the Ethernet adapter
Sample programs 5:
Selection and confirmation of the Ethernet adapter
Sample programs 6:
Activation of the configuration
Sample programs 7:
Confirming the activation of the configuration
Sample programs 8:
Generating variable mapping
Sample programs 9:
Restarting TwinCAT in RUN mode
Sample programs 11:
Confirming program start

Working with DC times in the controller

From the perspective of the controller the distributed clock time has the following characteristics:

The following 3 data types are recommended for handling DC times

Sample programs 12:

64- vs. 32-bit representation

Some EtherCAT slaves can only handle 32 bit values for representing the DC time or handle it as a process data. In order to prevent problems caused by overflow (every 4.2 seconds), we strongly recommend using 64-bit times in the controller.

    • 32-bit times supplied to the PLC must be complemented with the current High part
    • In this case only the Low part (lower 32 bit) should be transferred to the hardware

    This sample project

    Sample programs 13: Download (example file) contains a function block that cyclically adds the high part to a 32-bit DC time to make 64 bits.