Example Code

EtherCAT Programmatic Slave and Module Discovery

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • NI-9144

Code and Documents

Attachment

Description

NI LabVIEW Example: EtherCAT Programmatic Slave and Module Discovery

 

Overview

The attached example shows how to dynamically read EtherCAT slaves and modules. This type of setup is commonly used for scenarios where modules may be hot-swapped on a chassis or new EtherCAT slaves added to the system. A KnowledgeBase on the topic can be found here.

 

Note the NI-Industrial Communications for EtherCAT uses the NI Scan Engine for data access.

Instructions for Use

  • Setup a cRIO or PXI EtherCAT master following the instructions in the EtherCAT KnowledgeBase article
  • The example is configured for a cRIO. If a PXI is used the project must be modified.
  • Connect an 9144 EtherCAT Slave to the EtherCAT Master
  • Open the attached "Ecat Dynamic Programmatic.lvproj"
  • Open "Configure Scan.vi" and compare the procedure to the KnowledgeBase linked above.
    • Note that a lookup table is created for the different module data types. It is necessary to know the data type of the module being read ahead of time:
      Untitled.png

 

    • The example is currently configured to read data from a 9144 that contains a 9213, 9221 or 9485. If needed modify the code for different modules.

 

 

Software

To use this example you must have the following software installed:

  •  
  • NI-Industrial Communications for EtherCAT 2.3 or above.
  • LabVIEW 2009 or above.

Hardware

This example requires the following hardware.

  • cRIO or PXI with two Ethernet NICs.

Support and Contact

This add-on is provided as open-source software.  If it does not meet your exact specification, you are encouraged to modify the source code to meet your needs.  It is not officially supported by National Instruments.

 

National Instruments does not support this code or guarantee its quality in any way. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).

Jesse Dennis
Engineer
INTP

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.