Example Code

Programmatic Discovery of CompactRIO XNET C Series Modules in LabVIEW

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.

    Software

  • LabVIEW Real-Time Module
  • LabVIEW

    Driver

  • Other

Code and Documents

Attachment

Overview

The example demonstrates how to list the available NI-XNET devices on a CompactRIO system.

 

Description

The example lists all available NI-XNET modules with the available interface (a module can have multiple interfaces/ports) in a tree control.

Since a XNET session has to specify which interface will be used, a program may want to check first which interface are present on CompactRIO.

For this to work the NI-XNET modules have to be discovered by the CompactRIO controller. For older CompactRIO platforms that may require to compile a blank bitfile first. Please see Additional Information or References for more information.

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)
  • LabVIEW 2012 Real-Time Module (or compatible)
  • NI-XNET 14.0 (or compatible)
  • (depending on hardware) LabVIEW 2012 FPGA Module (or compatible)

 Hardware

  • CompactRIO controller that supports NI-XNET modules (see NI-XNET Readme >> Supported Hardware)
  • NI-XNET module (see NI-XNET Readme >> Supported Hardware)

 

Steps to Implement or Execute Code

  1. Open the attached file
  2. Run the VI 

 

Additional Information or References

XNET Discover Interfaces - Front Panel.png

 

XNET Discover Interfaces - Block Diagram.png

 

Readme: NI-XNET 14.0
http://download.ni.com/support/softlib//embedded%20networks/NI-XNET/Driver/NI-XNET%2014.0/readme.htm

 

On older CompacRIO it is necessary to compile and deploy a blank FPGA bitfile to be able to use the NI-XNET module in Real-Time. If you use these older CompactRIOs you also need the LabVIEW FPGA Module to be able to compile the bitfile.

Modern CompactRIO have no need for that blank FPGA bitfile any more:

 

Knowledgebase: Do I Need to Compile a Blank Bitfile for NI-XNET, NI-Industrial Communications for CANopen or DeviceNet?
http://digital.ni.com/public.nsf/allkb/333860B4B66BA4BD86257E6100452593

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Aldo A
Applications Engineer
National Instruments

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