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:
- -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
- -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).
4.1.1.1. Link Layer
Using one of the following demo application Link Layer options, the EC-Monitor will dynamically load the network driver for the specified network adapter card and use the appropriate network driver to access the Ethernet adapter for EtherCAT©.
ShowSyntaxLinkLayer()
in Common/EcSelectLinkLayer.cpp
is called automatically if the Demo application is started without parameters and lists the possibilities.
Note
Not all link layers are available on all operating systems or architectures. A detailed view in the form of a matrix can be found in the developer center.
- -i8254x <instance> <mode>
- Hardware: Intel Pro/1000 network adapter card
- <instance>
Device instance 1 = first, 2 = second, …
- <mode>
0 = Interrupt mode | 1 = Polling mode
- -ndis <IpAddress> <mode>
- Hardware: Hardware independent, only available for Windows.
- <IpAddress>
IP address of network adapter card, e.g. 192.168.157.2 or 0.0.0.0 if name given
- <mode>
0 = Interrupt mode | 1 = Polling mode
- Optional:
- --name
Adapter name. Service name from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards
- <DisablePromiscuousMode>
Disable promiscuous mode
- <DisableForceBroadcast>
- -snarf <adapterName>
- Hardware: Hardware independent, only available for VxWorks
- <adapterName>
Adapter name, e.g. fei0
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