Getting Started with CompactRIO

NI-Industrial Communications for CANopen 1.0.2 Help

Edition Date: July 2012

Part Number: 373254C-01

»View Product Info
Download Help (Windows Only)

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

Complete the following steps to use a C Series NI-IndCom for CANopen module in a CompactRIO chassis from the out-of-box configuration.

Step 1. Install the Required Software

Install the required software to the host computer in the following order:

  1. LabVIEW
  2. LabVIEW Real-Time Module
  3. LabVIEW FPGA Module
  4. NI-RIO
  5. NI-IndCom for CANopen

Step 2. Install NI-IndCom for CANopen to the CompactRIO RT controller

Use MAX to locate your CompactRIO controller under Remote Systems in the left pane. Right-click the Software item and select Add/Remove Software to launch the installer. You can install the required components in the following two methods:

  • NI-RIO with NI Scan Engine support—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-IndCom for CANopen. If this selection is dimmed, refer to the explanation on the right pane to resolve the problem, or use custom installation.
  • Custom software installation—Custom installation can be useful on controllers with small memory because this method enables you to avoid installation of unused components. Select the NI-IndCom for CANopen item. The installer selects the required dependencies (e.g. NI-RIO IO Scan).

Step 3. Add Modules to a LabVIEW Project

To compile an FPGA VI with the required communication logic, you must add NI-IndCom for CANopen modules to a LabVIEW project.

  1. Add the controller to the LabVIEW project. If the controller is online, you can right-click on the project item and select New»Targets and Devices»Existing target or device, then select the controller under Real-Time CompactRIO. If the controller is offline, you can add the controller by selecting New target or device.
  2. Select programming mode for the chassis. When you add the controller, a dialog box appears and asks you to select the programming mode for the chassis. Although NI-IndCom for CANopen uses the NI Scan Engine components, you must select LabVIEW FPGA Interface as the chassis mode. This configures the chassis to support compilation of an FPGA VI.

    Note Note  If the Discover C Series Modules dialog box appears, select the Do Not Discover button and proceed to step 5.
  3. Ignore errors for discovered NI-IndCom for CANopen modules. LabVIEW may report an error for NI-IndCom for CANopen modules, stating that LabVIEW FPGA is not supported. Do not change the chassis to Scan Interface mode. Ignore this error message and select Continue.
  4. Add the FPGA target. Right-click the chassis item under the controller, and select New»FPGA Target.
  5. Add the NI-IndCom for CANopen 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 the <Shift> key to select all NI-IndCom for CANopen modules in the list. Select OK to add the modules to the project. You can also add NI-IndCom for CANopen modules offline by selecting New target or device, then select C Series Module, and in the next dialog select the appropriate Module Type (e.g. NI 9881). When you use an NI-IndCom for CANopen module in a project, you do not need to have that module installed physically. For NI-IndCom for CANopen, the module in a project is simply a signal to the FPGA VI that NI-IndCom for CANopen communication is required for the slot.

Step 4. Compile and run the FPGA VI

If you are new to CompactRIO, you can use an empty FPGA VI in order to quickly get started with NI-IndCom for CANopen tools and examples. Select the FPGA target in LabVIEW project, and then select New»VI. When the front panel opens, select the LabVIEW run button (arrow) to compile and run the VI. Even though the VI is empty, it will load the required NI-IndCom for CANopen 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 re-compile the FPGA VI in order to incorporate NI-IndCom for CANopen support for the configured slots. Once the FPGA VI is re-compiled, you run it using the same methods that you used previously. This is typically done using the Open FPGA VI Reference from a host VI.

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

Table X-1: Actions that cause NI-IndCom for CANopen to load

Action Comment
Invoke Open FPGA VI Reference with a CANOPEN-enabled FPGA VI. NI-IndCom for CANopen loads regardless of whether Run the FPGA VI is checked in the configuration dialog.
Run CANOPEN-enabled FPGA VI using Interactive Front Panel Communication
Note Note  NI-IndCom for CANopen does not load when the CompactRIO system powers up. Even if you configure a CANOPEN-enabled FPGA VI to automatically load on power up, you must perform an action from Table X-1 prior to using NI-IndCom for CANopen.

Table X-2: Actions that cause NI-IndCom for CANopen to unload

Action Comment
Invoke Close FPGA VI Reference with shortcut option Close and Reset if Last Reference (default). If the reference is not the last to close, NI-IndCom for CANopen remains loaded. Shortcut options Close and Close and Abort without Reference Counting do not unload NI-IndCom for CANopen.
Power down CompactRIO
Run CANopen-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-IndCom for CANopen to unload, and then immediately load again. If you are using NI-IndCom for CANopen interfaces during the reset, the interfaces will be invalidated. Other methods such as Abort do not unload NI-IndCom for CANopen.
Run a different CANopen-enabled FPGA VI from the CANopen-enabled FPGA VI currently loaded. When you change FPGA VIs, the effect is the same as the reset method. NI-IndCom for CANopen unloads, and then immediately loads again.
Note Note  When using FPGA Interactive Front Panel Communication, stopping the FPGA VI does not unload NI-IndCom for CANopen. This applies to stopping the VI normally (e.g. from front panel button), or using the LabVIEW abort button (stop sign).

Step 5. Wait for Interfaces to be Detected

After the FPGA runs with NI-IndCom for CANopen support, it may take a few seconds for the new FPGA features to be detected, appropriate RT drivers to load, and NI-IndCom for CANopen modules to be detected. This delay occurs only after the action from Table X-1 is performed.

You can use the options to detect NI-IndCom for CANopen hardware:

  • MAX Devices & Interfaces—You can detect the interfaces visually by opening the Devices & Interfaces tree under the RT controller in MAX. Once the hardware is detected, you can see CANopen hardware information.
  • 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-IndCom for CANopen interfaces. NI-IndCom for CANopen also provides a System API with properties specific to NI-IndCom for CANopen hardware.

Step 6. Use NI-IndCom for CANopen

Once the interfaces are detected, you are ready to use these interfaces. Within your RT VI, you can use the NI-IndCom for CANopen VIs to read and write data.


Not Helpful