Getting Started with CompactRIO Hardware and LabVIEW

Tutorial


Getting Started with CompactRIO Hardware and LabVIEW

5 Steps to Get You Going

These tutorials are designed to introduce you to the core concepts needed for initial product setup.


Before You Begin

Make sure you have the following items:


Software

  • Access email for LabVIEW and any optional LabVIEW add-ons

Hardware

  • Windows OS host computer
  • CompactRIO Controller
  • C Series I/O modules

Accessories

Download and Install Software

Step 1.

During this process, you will be installing and activating the following software and drivers on your development computer:


  • LabVIEW
  • LabVIEW Real-Time Module
  • (Optional) LabVIEW FPGA Module
    The LabVIEW FPGA Module is only required for the following cases:
  • (Optional) NI-DAQmx driver
    NI-DAQmx is required when programming using the NI-DAQmx API, and it is not compatible on all CompactRIO hardware. For a list of models that support NI-DAQmx, visit the CompactRIO Controllers catalog page and sort by Programming Method
  • NI CompactRIO driver

  1. Download LabVIEW. Customers can access software downloads from ni.com in two ways:
    • Software claim email:
      1. After you buy LabVIEW or other software modules, you or your purchasing agent receives an email to claim access to NI software. Click the ACCEPT ACCESS button in the email and log in to your ni.com account to complete your claim.
      2. After you’ve claimed access to your software, you will see a screen that confirms your access and includes a link to download the software. If you have not already done so, download your software using this link.

    • If you did not receive or do not have this email, follow these steps:
      1. Log in to your ni.com account.
      2. Browse to ni.com/downloads, select Programming Environments, and search for LabVIEW Download.
      3. Select the LabVIEW download page from the search results, then select the version of LabVIEW that you want, and then click Download. For older versions of LabVIEW, refer to Download Older Versions of NI Software.
  2. After your download is complete, launch the executable. This step installs Package Manager or updates it, if needed.
  3. After Package Manager is installed, follow the prompts to complete installation of LabVIEW and the following modules and drivers.
    • LabVIEW Real-Time Module
    • NI CompactRIO driver
    • (Optional) LabVIEW FPGA Module
    • (Optional) NI-DAQmx driver

    • You can select any other add-ons or drivers that you know you'll need for your application or that you have a license for, but this list includes the software you will need for this tutorial. Notice that you can return to this installation and add anything else you need later.


Return to top

Activate and Register Products

Step 2.

  1. After the installation is complete, the Activation Wizard opens automatically.
  2. When you are prompted, click LOG IN TO ACTIVATE.
  3. Enter your NI User Account credentials and click LOG IN.
    All your unlicensed products are listed in the Activate Software window.
  4. Select Check my account for licenses and click Activate.
    If the Check my account for licenses method does not successfully activate your software, you can use your serial number to activate your software. , instead. Select Enter a serial number in the Activate Software window, enter your serial number for each product, then click Activate. Learn how to find your software serial number.
  5. After the licenses associated with your account are verified successfully, click the Finish button to complete activation.
    This process registers your software to you. After registering your software, you can access support and online training.
  6. If you're working offline or neither of these methods work, try one of these alternative methods for activating NI software:
    • Offline Activation --- If you are activating your software on an offline machine, visit the NI Product Activation page and fill out the Activation Code Generation Form. Notice that you will need a serial number and computer ID to complete this process. You can find your computer ID in the Activation Wizard or using the NI License Manager.
    • Volume or Enterprise License Activation --- If you have a Volume License or Enterprise Agreement, your software is licensed using a license server. Contact the software administrator for your company for more information.
    • Academic Volume License Activation --- If you are a student using an Academic Volume License, you will receive one or more serial numbers that can be used to license and activate your NI software. You can install software individually on a computer, and you will need to activate the software on each computer. For more information about deploying NI software to multiple machines, refer to the Academic Volume License Administrator Resources
  7. Restart your computer, if prompted to do so.


You've now installed the LabVIEW software that you'll need for your CompactRIO system. Next, we'll see how to set up the connection of the CompactRIO hardware.


Return to top

Connect the Hardware

Step 3.

With LabVIEW installed and activated on your host computer, the next step is to connect the hardware. Watch this video or follow the instructions provided.

  1. Ensure that power is disconnected from the CompactRIO chassis.
  2. Plug in the C Series modules. As the modules are fully seated, they’ll click into place.
  3. Ground the device using ring lug, grounding screw, and wire. Refer to the Grounding Guide for Test and Measurement Devices for more information about grounding your device.
    1. Attach the ring lug to the wire.
    2. Remove the grounding screw from the grounding terminal on the CompactRIO chassis.
    3. Attach the ring lug to the grounding terminal.
    4. Tighten the grounding screw.
    5. Attach the other end of the wire to the chassis safety ground using a method that is appropriate for your application.
  4. Connect the CompactRIO chassis to power.
    1. Ensure that your power supply is powered off.
    2. Install the ferrite on the negative and positive leads of the power supply. This connection will prevent electromagnetic interference that could affect the CompactRIO system.
    3. If the power connector from the CompactRIO chassis is attached, remove it.
    4. Connect the power supply to the power connector.
    5. Tighten the terminal screws on the power connector.
    6. Install the power connector to the front of the CompactRIO chassis.
    7. Tighten the power connector screws.
    8. Power on the power supply. The Power LED should light, the Status LED lights briefly, and then starts blinking every few seconds indicating that software has not been installed on the CompactRIO device.
  5. Use the USB cable to connect the CompactRIO system to the computer where you previously installed LabVIEW. This computer is often called the host computer because it serves as the gateway to host the user interface for running code on the CompactRIO hardware. 
  6. If all software and drivers are installed on the host computer, the NI CompactRIO driver should detect the hardware and launch a Device Detected screen. Leave this for now, and we’ll return to it later.

  7. Connect an Ethernet cable from the CompactRIO to your network or directly to your router.


You've now set up the connections on your CompactRIO system. Next, we'll learn how to configure the CompactRIO system and install the necessary software on it.


Return to top

Configure the Hardware

Step 4.

You've set up the CompactRIO hardware, so now it's time to install software on it and configure it. Watch this video or follow the instructions provided.

  1. If you don’t already have it open, launch NI Measurement & Automation Explorer (MAX). MAX is installed when NI hardware drivers are installed. You can open MAX in two ways:
    • Launch from the Device Detected window, if that appeared in the previous section.
    • Launch from your installed applications.
  2. Expand the Remote Systems option in MAX.
  3. Your device should be listed with the hardware model and serial number as the name.
  4. Assign login credentials for your CompactRIO device by clicking the Set Permissions button. You will be prompted to log in.
  5. Log in using the username admin. Leave the password field blank if you have not changed the default password, or enter the current password.
  6. Double-click admin in the list of users under the Users tab. Click Change Password, enter a new password, and click OK. Click Save, and confirm you'd like to change the password.
  7. To install software onto the CompactRIO system, expand the CompactRIO entry, right-click Software and select Add/Remove Software.
  8. A recommended software package, based on your hardware model and the software version you have installed on the host computer, should be highlighted in the dialog box. Click OK to begin the installation.
  9. You can select any additional packages that you know you’ll need. The default selection installs the typical components required. You can return and install additional components as needed later. Click Next to begin the installation.

    Notice that only one version of software can be installed on the CompactRIO device at a time.

    When your installation is finished, you can expand the Software option under the CompactRIO entry and in it you should see the corresponding version that you’ve installed on your CompactRIO device. It will be the same version as the LabVIEW version you’ve installed on the host computer.
  10. Configure settings for the CompactRIO system like Device Name, Time Settings, and Network settings.
    • (Optional) Give the CompactRIO device a new Device Name in the System Settings tab.
    • Click the Time Settings tab, set the Current time and Time Zone on your device, then click Save.
    • On the Network Settings tab, configure the network settings if you’re going to connect your CompactRIO system to your local network. This connection would allow you to connect to the CompactRIO device from any computer on the local network, not needing the computer to be directly connected. 

      Toward the bottom of the tab, you’ll notice the IP address that is generated by the USB connection between the CompactRIO device and your computer. By default, the device connects to the host computer with an IP address of 172.22.11.X.

      • To configure the Ethernet settings, first set the IPv4 address as DHCP or Link Local. This setting configures the CompactRIO device to detect an IP address if it is connected to a network that will assign it one.
      • Click Save and restart the CompactRIO system if prompted. After the system is restarted, it should detect an IP address if plugged into a network that assigns it one.

      If the CompactRIO system doesn’t detect an IP address, you can configure the IP address manually by selecting Static for the IPv4 settings, then configuring an IP address that is on the same subnet as your host computer and with a subnet mask of 255.255.255.0. For example, you could assign an IP address to your host computer of 10.0.0.1 and an IP address on the CompactRIO device of 10.0.0.2.

You’ve now configured your CompactRIO system and installed the necessary software. In the next section, you’ll take a measurement and confirm everything is working with your CompactRIO system.


Return to top

Take a Measurement

Step 5.

Your CompactRIO hardware should now be configured. Next, we'll learn how to take a simple measurement in LabVIEW using the CompactRIO device. Watch this video or follow the instructions provided.

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.

  1. Launch LabVIEW from the Start menu . After it loads, open the NI Example Finder by selecting Help then Find Examples.
  2. 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.
  3. 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.
  4. 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.
  5. You can discover the CompactRIO system that you’re connected to under the Real-Time CompactRIO selection. Select your device and click OK.
  6. 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.
  7. 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.
  8. Select your copy and click Add File.
  9. 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.
  10. Ensure that changes in programming mode are deployed to the target by right-clicking the CompactRIO target and selecting Deploy.
  11. Double-click the Voltage - Continuous Input VI to open it.
  12. 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.
  13. 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.
  14. 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

Where to Go Next

Resources

To continue learning about using CompactRIO hardware with LabVIEW, NI provides you with a number of options.

Get more products up and running with easy, guided tutorials.

Return to Getting Started