This procedure assumes you're using a CompactRIO model and C Series modules that are compatible with the NI-DAQmx driver. Refer to the Download and Install Software section for more information about how to determine whether this software will work with your hardware. If your hardware is not compatible, you can use LabVIEW FPGA Interface Mode or Real-Time Scan Mode to take a measurement. Refer to the examples and documentation for your hardware for more information.
- Launch LabVIEW from the Start menu . After it loads, open the NI Example Finder by selecting Help then Find Examples.
- Open a pre-built example that allows us to take an analog measurement. Browse to Hardware Input and Output, then DAQmx, Analog input, and find the Voltage – Continuous Input example.
- For this example to work on your CompactRIO hardware, you first need to create a new LabVIEW project. From LabVIEW, select Create Project, then a Blank Project.
- Add the CompactRIO device as a new target for your code to run on by right-clicking the project, selecting New and then Targets and Devices.
- You can discover the CompactRIO system that you’re connected to under the Real-Time CompactRIO selection. Select your device and click OK.
- To add the Voltage - Continuous Input VI to the LabVIEW project, right-click the CompactRIO target and select Add then File... which opens the file explorer. By default, LabVIEW examples are found in Program Files (x86)/National Instruments/<LabVIEW version>/Examples.
- Create a copy of the Voltage – Continuous Input VI so that any changes you save to these files will only be reflected in your copy, not permanently applied to the example.
- Select your copy and click Add File.
- Ensure that the C Series modules are configured in Real-Time (NI-DAQmx) mode under the Real-Time Resources item in the LabVIEW project. If your C Series module is not listed there, drag it under the Real-Time Resources item.
- Ensure that changes in programming mode are deployed to the target by right-clicking the CompactRIO target and selecting Deploy.
- Double-click the Voltage - Continuous Input VI to open it.
- Configure the settings of the VI to use for measurement.
- Set the Physical Chanel to whichever channel your signal is connected to on the C Series module. For example, Mod1/ai0 is the first input channel of a card in slot 1 of the CompactRIO system.
- Set the Max and Min voltage values to appropriate values for your C Series module.
- Configure the Sample Rate such that you can properly sample your signal.
- Enable Logging Mode, if you'd like to save your data to a TDMS file.
- Ensure your measurement signal is physically connected to your analog input channel, if you have one. Also ensure that the input signal is compliant to the input specifications for your module.
- Click the Run button on the VI and close the deployment window when it finishes.
If everything is configured, your code should run, and your graph should populate with data. If you don't have a signal connected to your input channel, you'll measure a floating signal.
You should now have your CompactRIO system set up, configured with LabVIEW, and taking a measurement. Refer to the following links for more resources to support LabVIEW development with CompactRIO hardware.
Return to top