Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
What is Developer Zone?
United States

Document TypeTutorial
NI Supported: Yes
Publish Date: Aug 04, 2009


Feedback


Yes No

Related Links - Developer Zone

Related Links -Products and Services

Programmatic Discovery, Configuration, and Access of CompactRIO Scan Mode I/O with LabVIEW

1 Ratings | 5.00 out of 5
 Print |  PDF

Overview

The LabVIEW 2009 Real-Time Module and NI-RIO 3.2 increase the flexibility of CompactRIO Scan Mode, giving you the ability to programmatically discover, configure, and access I/O in a deployed system. Using the new programmatic I/O API, applications can be developed to handle the presence of any combination of supported C Series I/O Modules. For example, a single CompactRIO system could be used as simple temperature data logger when thermocouple input modules are present or as a closed-loop motor controller when PWM output and quadrature encoder input capable digital I/O modules are present, without deploying new settings from a development machine. This paper explores the new programmatic I/O functionality in LabVIEW.

Table of Contents

  1. Discovering I/O in a Deployed System
  2. Configuring I/O
  3. Read and Writing I/O
  4. Create Flexible CompactRIO Scan Mode Applications
  5. Related Resources

Discovering I/O in a Deployed System

A CompactRIO system may contain I/O modules that are supported in scan mode or in LabVIEW FPGA for advanced functionality. The discovery method discussed here applies to I/O modules supported in scan mode (FPGA I/O modules can be discovered using this library of VIs).

To identify the C Series I/O Modules that are present in a CompactRIO system, call the Refresh local I/O VI on the NI Scan Engine palette (this VI should not be called while performing control as it will induce jitter on the system). Once the I/O is refreshed, you can access references to each I/O module through LabVIEW property nodes and a new hierarchy of objects. For discovery, use the class Variable » Variable Object » Variable Container and select the Children[] property. This provides an array of references to the I/O modules that are currently present in the system. To identify the I/O modules, traverse the Children[] array using the To More Specific Class function to convert the references to RSI Module, and select the Model and Slot property, as shown below.

 

Figure 1. The LabVIEW Real-Time code above will discover the scan mode I/O modules that are currently present in the system.

 

The Children[] property of each I/O module is array of I/O variable references that can be used to read and write to each channel. Before reading and writing to each channel, use the To More Specific Class function to cast the references to I/O variables.

Figure 2. Use the Children[] property of a scan mode module to access the I/O variable channels

 

Once discovered, the properties of C Series I/O Modules, typically found in the LabVIEW Project, can be configured programmatically as discussed below.

 

Configuring I/O

Using the new programmatic I/O API, properties that were previously only accessible in the LabVIEW Project can now be configured at runtime. Each I/O module supported by scan mode shares the properties and methods of the RSI Module object, such as Slot and Model. Several I/O modules have their own object class with additional properties and methods for setting voltage gains, shunt calibration, etc. For example, the NI 9213 has a property for setting the thermocouple type of each of its input channels. Specialty digital capable DIO modules also have their own object class, SD Module, which provides properties and methods for configuring PWM, quadrature encoder, and high-speed counter functions.

For configuration, obtain references to each I/O module through discovery, as discussed in the previous section, or by simply dragging and dropping an I/O module to the block diagram from the LabVIEW Project.

Figure 3. Drag and drop scan mode I/O modules to the block diagram to get a URL to use for configuration.

 

 

Read and Writing I/O

LabVIEW 2009 includes a new set of VIs for programmatically reading and writing I/O variables and shared variables. Simply provide the URL of the variable to access through discovery, or by creating a constant from the shared variable refnum in input of the shared variable VIs and selecting browse.

Figure 4. To browse for variables, simply create a constant from the shared variable VI input.

 

 

You have the option to browse variables currently deployed in various engines or the variables in your LabVIEW Project.

Figure 5. The browse functionality allows you to select any variable currently deployed or in the LabVIEW Project

 

The VIs provided on the Shared Variable palette read and write a single channel at a time. For applications requiring the highest performance, use the NI Scan Engine Advanced I/O Access VIs to read and write to an entire module at once, as an array.

 

Create Flexible CompactRIO Scan Mode Applications

The LabVIEW 2009 platform increases the breadth of applications addressable with CompactRIO Scan Mode. You now have the ability to design and develop flexible, self-configuring applications that can adapt to a variety of I/O requirements in the field, without the need for reprogramming the system.

To see an example that uses the programmatic I/O API to discover, configure, and access CompactRIO Scan Mode I/O, click here.

 

Related Resources

White paper: Using CompactRIO Scan Mode with NI LabVIEW Software

 

1 Ratings | 5.00 out of 5
 Print |  PDF

Reader Comments | Submit a comment »

unable to detect modules on crio-9075
Hi, I would like to know why this VI can only be used for a specific model of cRIO? for instance, I tried it on a cRIO-9075, couldn't detect the modules. However it works on cRIO-9074...why?
- Sheikh Ezaiddin,Virtual Instrument and System Innovation Sdn Bhd. sheikh.ezaiddin@visi.com.my - Oct 04, 2012

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL 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/).