Programming Languages

Overview

 

Programming the Master Core Library in C/C++

The EtherCAT Master Core Library and the RAS Server Module are implemented in C++. The API interfaces are C language interfaces, thus the master can be used in ANSI-C as well as in C++ environments.

  • EcMasterDemo is the basic example application for EC-Master. The example shows how to initialize the master and how to put the network into operational state. Based on the provided ENI file this example can handle all kind of EtherCAT Slaves.
  • EcMasterDemoSyncSm demonstrates a different network timing which requires the interrupt from the Ethernet Controller used by the master. This cyclic frame is transmitted at the begin of the cycle and the process data are updated immediately after the frame returns.
  • EcMasterDemoDc is a good starting point for application requiring the accurate synchronization of slaves based on the Distributed Clocks (DC) technology. To synchronize the master controller with the slaves several modes can be selected.
  • EcMasterDemoMotion comes with a simple motion control library to control drives implemented according to the profile CiA402 and the ETG Implementation Directive ETG.6010. The example supports the operation modes Cyclic Synchronous Position (CSP) and Cyclic Synchronous Velocity (CSV).

Programming the RAS-Client Library in C/C++

The RAS Client Library is part of the Feature Pack “Remote Access API” and provides in conjunction the RAS Server the master programming interface on a remote system. The RAS protocol is by default transported with TCP/IP and Ethernet, but also another infrastructure, e.g. Shared Memory, can be used.

  • The EcMasterDemoRasClient example application demonstrates how to connect to the RAS Server and to call EC-Master APIs like emScanBus or emGetMasterState, access process data using emGetProcessDataBits or send notifications to the EC-Master application.

Operating systems and tools

  • Supported Operating Systems: All
  • Supported Compilers: Microsoft, GNU, LLVM
  • Supported IDE: Microsoft Visual Studio, Eclipse, WindRiver Workbench, QNX Momentics, IAR, Keil MDK

Programming in C#

The example EcMasterDemoDotNet and the .NET wrapper are written in C#. The target platform is AnyCPU. The other libraries are written in C++ and are platform specific. The Wrapper Library is a helper that prepares the API for .NET. The demo runs with MS .NET Framework as well as with Mono.

  • EcMasterDemoDotNet is a basic Windows Forms (C#) GUI application for EC-Master. The example shows how to initialize the master and how to put the network into operational state. Based on the provided ENI file this example can handle all kind of EtherCAT Slaves. It is also shown how to read and write a variable. Even an example of how to read a register from the CoE object dicitionary can be found.

Operating systems and tools

  • Supported Operating Systems: Windows (MS .NET 2.0, MS .NET Standard 2.0), Linux (MS .NET Standard 2.0, Mono)
  • Supported IDE: Microsoft Visual Studio (Code)
  • Supported Compiler: Microsoft

Programming in Python

The examples and the Python wrapper are written in Python. They are not platform specific. The other libraries are written in C++ and are platform specific. The EcWrapper is a helper that prepares the API for python.

  • Similar to the other demos the EcMasterDemoPython shows how to call the EtherCAT Master API. There is also a Python demo for the EC-Simulator. The python demos can also run in interactive mode e.g. to set an output of the EtherCAT network or something else. This is very useful to quickly test different behaviors of the EtherCAT network e.g. with the EC-Simulator.

Operating systems and tools

  • Supported Operating Systems: Windows (Python 3.7), Linux (Python 3.7)
  • Supported IDE: Python IDLE Shell, Microsoft Visual Studio Code