Getting Started with CompactRIO

When you use a C Series NI-XNET module in a CompactRIO chassis, the NI-XNET features on LabVIEW RT are the same as on other LabVIEW RT targets, such as PXI. Nevertheless, the communication between the NI-XNET RT driver and module does not exist in the default FPGA VI that ships with CompactRIO. Prior to using NI-XNET features, you must use LabVIEW FPGA to compile and run an FPGA VI that contains the required communication logic.

The following steps describe how to use a C Series NI-XNET module in a CompactRIO chassis from its out-of-box configuration.

  1. Install the required software to the host computer.
    1. LabVIEW (Including RT and FPGA)

      Install LabVIEW, LabVIEW Real-Time, LabVIEW FPGA, and NI-RIO. For supported versions of the software mentioned above, refer to the Supported Platforms section in the NI-XNET readme file.

    2. NI-XNET

      Install NI-XNET after the required LabVIEW components.

  2. Install NI-XNET to the CompactRIO RT controller. Use MAX to find your CompactRIO controller under Remote Systems, then right-click Software and select Change/Remove Software. There are two ways to install the required components:
    • NI-RIO with NI Scan Engine Support If this selection is dimmed, refer to the explanation on the right to resolve the problem, or use custom installation. After selecting this item, the next page displays a list of add-ons. Scroll down to the bottom of the add-on list to check NI-XNET.
    • Custom Software Installation Custom installation can be useful on controllers with small amounts of memory because you can use it to avoid installing unused components. Select the NI-XNET item, which in turn selects the required dependencies (for example, NI-RIO IO Scan).
  3. Add modules to the LabVIEW project.
    To compile an FPGA VI with the required communication logic, you must add NI-XNET modules in a LabVIEW project.
    1. Add the controller.

      Assuming your controller is online, you can right-click the project item and select New»Targets and Devices»Existing target or device, then select your controller under Real-Time CompactRIO. If your controller is offline, you can add it by selecting New target or device.

    2. Select the chassis programming mode.

      When you add the controller, a dialog asks you to select the programming mode for the chassis. Although NI-XNET uses scan engine components, you must select LabVIEW FPGA Interface as the chassis mode. This configures the chassis to support compiling an FPGA VI.

      If a Discover C Series Modules? dialog appears, click the Do Not Discover button and proceed to step d.

    3. Ignore errors for discovered NI-XNET modules.

      LabVIEW 2010 may report an error for NI-XNET modules, stating that LabVIEW FPGA is not supported. LabVIEW 2011 or later does not report this error. Do not change the chassis to Scan Interface mode. Ignore this error message and click Continue.

    4. Add NI-XNET modules.

      Right-click the chassis item under the controller (not FPGA) and select New»C Series Modules»Existing target or device . Select the plus sign to discover and then hold <Shift> to select all NI-XNET modules in the list. Click OK to add the modules to the project. You also can add NI-XNET modules offline by selecting New target or device, then C Series Module, and in the next dialog select the appropriate Module Type (for example, NI 9862). When you use an NI-XNET module in a project, you do not necessarily need to have that module installed physically. For NI-XNET, the module in the project is simply a signal to the FPGA VI that NI-XNET communication is required for that slot.

  4. Compile and run the FPGA VI.If you are new to CompactRIO, you can use an empty FPGA VI to get started quickly with NI-XNET tools and examples. Select the FPGA target in the LabVIEW project, and then select New»VI. When the front panel opens, click the LabVIEW run button (the arrow) to compile and run the VI. Although the VI is empty, it loads the required NI-XNET support. When compilation completes, and the VI runs the first time, you can close the front panel and proceed to the next step.

    If you have an existing FPGA VI in your project, you must recompile the FPGA VI to incorporate NI-XNET support for the configured slots. When the FPGA VI is recompiled, you run it using the same methods you used previously. This typically is done using Open FPGA VI Reference from a host VI.

    The following tables provide a detailed list of actions that cause NI-XNET to load and unload. NI-XNET must be loaded for its hardware to be detected. Within the tables, the term XNET-enabled FPGA VI refers to an FPGA VI compiled with a project that contains at least one NI-XNET module. The term XNET-disabled FPGA VI refers to an FPGA VI compiled with no NI-XNET modules.

    Table 1. Actions That Cause NI-XNET to Load
    Action Comment
    Invoke Open FPGA VI Reference with an XNET-enabled FPGA VI. NI-XNET loads regardless of whether Run the FPGA VI is checked in the configuration dialog.
    Run the XNET-enabled FPGA VI using Interactive Front Panel Communication.
    Note NI-XNET does not load when the CompactRIO system powers up. Even if you configure an XNET-enabled FPGA VI to load automatically on power on, you must perform an action from Table 1 prior to using NI-XNET.
    Table 2. Actions That Cause NI-XNET to Unload
    Action Comment
    Invoke Close FPGA VI Reference with the shortcut option Close and Reset if Last Reference (default). If the reference is not the last to close, NI-XNET remains loaded. The shortcut options Close and Close and Abort without Reference Counting do not unload NI-XNET.
    Power down CompactRIO.
    Run XNET-disabled FPGA VI. This applies to Open FPGA VI Reference or Interactive Front Panel Communication.
    Invoke Reset using the Invoke Method node of the FPGA interface. Reset of an open FPGA reference causes NI-XNET to unload, and then immediately load again. If you are using NI-XNET sessions during the reset, the sessions are invalidated. Other methods such as Abort do not unload NI-XNET.
    Run a different XNET-enabled FPGA VI from the XNET-enabled FPGA VI currently loaded. When you change FPGA VIs, the effect is the same as the reset method. NI-XNET unloads and then immediately loads again.
    Note When using FPGA Interactive Front Panel Communication, stopping the FPGA VI does not unload NI-XNET. This applies to stopping the VI normally (for example, from the front panel button), or using the LabVIEW abort button (the stop sign).
  5. Wait for interfaces to be detected. After the FPGA runs with NI-XNET support, it may take a few seconds for the new FPGA features to be detected, appropriate RT drivers to load, and NI-XNET modules to be detected. This delay occurs only after you perform the action from Table 1.There are several options for detecting NI-XNET interface hardware:
    • MAX Devices & Interfaces You can detect the interfaces visually by opening the Devices & Interfaces tree under the RT controller in NI MAX. Once the hardware is detected, you can perform a self test to confirm that all hardware and software is ready to use.
    • LabVIEW Interface I/O Name When you drop an XNET interface I/O name control on the front panel of an RT VI, the control uses features similar to NI MAX to display available interfaces. For interface detection to operate, you must right-click the RT controller in the LabVIEW project and select Connect (or Deploy). Once connected, you can use the interface I/O name to select an interface prior to running the RT VI.
    • System API If you need to detect interfaces programmatically within a running RT VI, National Instruments provides APIs for this purpose. The NI System Configuration API can detect any NI hardware product, including NI-XNET interfaces. NI-XNET also provides a System API with properties specific to NI-XNET hardware. If you run your RT VI as a startup VI (for example, after power on), you must perform an action from Table 1, then use a System API to wait for the required interfaces prior to calling XNET Create Session. If you create an I/O session prior to detecting the specified interface, an interface-not-found error can occur.
  6. Use NI-XNET. Once the interfaces are detected, you are ready to use them. Within your RT VI, NI-XNET sessions are used to read and write I/O data. For more information, refer to the Sessions topics.