4. Getting Started

To enable a quick and easy start, every EC-Monitor package comes with a pre-compiled EcMonitorDemo executable. This example application handles the following tasks:

  • EC-Monitor initialization

  • Process Data acquisition with EC-DAQ

  • Periodic Job Task in polling or interrupt mode

  • Record and replay wireshark traces

  • Logging

See also

Example application for detailed explanation

4.1. Running EcMonitorDemo

To capture the EtherCAT traffic insert a TAP device after the Master Controller.

Start the EcMonitorDemo from the command line to process the captured EtherCAT frames. At least a Link Layer and a ENI file must be specified.

EcMonitorDemo -winpcap 192.168.157.2 1 -f eni.xml -t 0 -v 3

See also

Platform and Operating Systems (OS) for OS specific additional instructions to run the demo application

4.1.1. Command line parameters

EcMonitorDemo <LinkLayer> [-f ENI-FileName] [-t time] [-b cycle time] [-a affinity] [-v level] [-perf] [-log prefix [msg cnt]] [-lic key] [-sp [port]] [-auxclk period] [-rec [prefix]] [-play pcap-FileName] [-dacrec file name]

The parameters are as follows:

-f <configFileName>

Path to ENI file

-t <time>

Running duration in msec. When the time expires the demo application exits completely.

<time>

Time in msec, 0 = forever (default = 120000)

-b <cycle time>

Specifies the bus cycle time. Defaults to 1000 µs (1 ms).

<cycle time>

Bus cycle time in µsec

-a <affinity>

The CPU affinity specifies which CPU the demo application ought to use.

<affinity>

0 = first CPU, 1 = second, …

-v <level>

The verbosity level specifies how much console output messages will be generated by the demo application. A high verbosity level leads to more messages.

<level>

Verbosity level: 0=off (default), 1..n=more messages

-perf [<level>]

Enable max. and average time measurement in µs for all EtherCAT jobs (e.g. ProcessAllRxFrames).

<level>

Depending on level the performance histogram can be activated as well.

-log <prefix> [<msg cnt>]

Use given file name prefix for log files.

<prefix>

<msg cnt>

Messages count for log buffer allocation

-lic <key>

Use License key.

<key>

26 characters long license key.

-oem <key>

Use OEM key

<key>

64 bit OEM key.

-sp [<port>]

If platform has support for IP Sockets, this command-line option enables the Remote API Server to be started. The Remote API Server is going to listen on TCP Port 6000 (or port parameter if given) and is available for connecting Remote API Clients.

<port>

RAS server port

-auxclk <period>

Use auxiliary clock

<period>

Clock period in µs (if supported by Operating System).

-rec [<prefix>]

Packet capture file recording

<prefix>

File name prefix

-play <FileName>

Packet capture file processing

<FileName>

File name (*.pcap|*.pcapng)

-dacrec <FileName>
<FileName>

Configuration file

4.2. Compiling the EcMonitorDemo

The following main rules can be used to generate the example applications for all operating systems.

  • <OS> is a placeholder for the operating system used.

  • <ARCH> for the architecture. If different architectures are supported.

4.2.1. Software Development Kit (SDK)

The EC-Monitor development kit is needed to write applications based on the EC-Monitor core. The EC-Monitor core is shipped as a library which is linked together with the application.

The following components are supplied together with an SDK:

  • /Bin: Executables containing the EC-Monitor core

  • /Doc: Documentation

  • /Examples: Example applications as source code

  • /SDK: EtherCAT Software Development Kit containing libraries and header files to build C/C++-applications

  • /SDK/INC: Header files to be included with the application

  • /SDK/LIB: Libraries to be linked with the application

  • /SDK/FILES: Additional files for platform integration

  • /Sources/Common: Shared source code

4.2.2. Include search path

The header files are located in the following directories:

<InstallPath>/SDK/INC/<OS>/<ARCH>
<InstallPath>/SDK/INC
<InstallPath>/Sources/Common

4.2.3. Libraries

The libraries are delivered as static, dynamic or both. This is depending on the operating system. They are located in the following directories:

Static libraries
<InstallPath>/SDK/LIB/<OS>/<ARCH>
EC-Monitor core
libEcMonitor.a
EC-Monitor RAS server (optional)
libEcMonitorRasSrv.a
Dynamic libraries
<InstallPath>/Bin/<OS>/<ARCH>
EC-Monitor core
libEcMonitor.so
EC-Monitor RAS server (optional)
libEcMonitorRasSrv.so

Whether it is a Shared Object *.so or a Dynamic Link Library *.dll depends on the operating system.

4.2.4. Preprocessor definitions

The following preprocessor directives must be set in the build environment or project:

EC_MONITOR

Exclude the EC-DAQ support in the demo:

EXCLUDE_DAQ_SUPPORT