Getting Started with Instrument Control and LabVIEW

Tutorial


Getting Started with Instrument Control Hardware and LabVIEW

We want to help you get started with NI products!

Tell us how by participating in compensated user interviews.

See how to set up Instrument Control devices or modules with LabVIEW, including software install, activation, hardware connection, and configuration instructions.


Additional Languages

Chinese (简体中文)
Deustch
Español
Français
Japanese (日本語)
Korean (한국어)

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

  • Development computer
  • Instrument control device

Accessories

    • USB, serial, GPIB, or Ethernet cable, if needed depending on the type of instrument control device
    • Power supply, if needed for your instrument control device.
    • (Optional) PXI system, if your instrument control device is a PXI module
    • For more information about which Instrument Control accessories are right for you, refer to the documentation for your hardware for more information about compatibility and requirements.

Download and Install

Step 1.

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


  • LabVIEW
  • NI-VISA
  • One or more of the following additional drivers:
    • NI-Serial
    • NI-488.2
      NI-Serial and NI-488.2 are needed when using NI's serial devices and GPIB devices, respectively

  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.
    • NI-VISA
    • (Optional) NI-Serial
    • (Optional) NI-488.2

    • 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 instrument control system. Next, we'll see how to set up the connection of the instrument control hardware.

Return to top

Connect the Hardware

Step 3.

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

2:44

Instrument Control devices communicate to instruments using serial, GPIB, or Ethernet interfaces. They connect to the computer or controller with a bus, such as PXI/PXI Express, PCI/PCI Express, USB, Ethernet, or a few others. Instrument control devices are represented by many combinations of the interface and the bus.


This section of the tutorial assumes that the instrument control device is connected to the development computer with USB or Ethernet.


Refer to the GPIB Hardware Installation Guide for:

  • GPIB-USB
  • NI PCIe-GPIB, NI PCIe-GPIB+, PCI-GPIB, PCI-GPIB+, PCI-GPIB/LP, and PCI-8232
  • PMC-GPIB
  • NI ExpressCard-GPIB
  • GPIB-ENET/100
  • GPIB-ENET/1000

Refer to the Serial Installation Guide for:

  • PXI-843x
  • PXIe-843x
  • PCI-843x
  • PCIe-843x
  • USB-232
  • USB-485

  1. Connect the instrument control device to the development computer using one of the following methods:
    • Connect the instrument control device to a USB port on development computer using the appropriate USB cable.
    • Connect the instrument control device to an Ethernet port on the development computer using the appropriate USB cable.
  2. If the instrument control device requires a power connection, plug the power in and turn on the device.
  3. With the drivers already installed and if the development computer is running, the operating system automatically detects the instrument control device.
  4. Most instrument control devices have a combination of status LEDs, such as Power, Ready, and Active, that indicate the state of the device once it is turned out. Reference the documentation for your device for information about status LEDs and what they indicate.
  5. Connect any instruments to your instrument control device.
    1. Ensure that the instruments and the development computer are at the same ground potential.
    2. Connect any instruments to your device using the appropriate Serial, GPIB, or Ethernet cable for your application and configuration.
    3. Plug in and turn on your instruments.
    4. Your instrument may have status LEDs that indicate whether they are detected by the instrument control device. In either case, we will confirm that the instrument is communicating with the instrument control device in the next section.


You've now set up the connections on your instrument control device. Next, we’ll learn how to configure the instrument control device and run a sample communication.


Return to top

Configure the Hardware

Step 4.

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

4:23
  • If you are using a serial instrument, complete the following steps:
    1. Launch NI Measurement & Automation Explorer (MAX) from your installed applications. MAX is installed when NI hardware drivers are installed.
    2. Expand the Devices and Interfaces option in MAX under My System to list your serial and parallel ports. Serial ports are labelled COM1, COM2, and so on.
    3. Select the serial port where your instrument is connected.
    4. Click the Port Settings tab at the bottom of the configuration panel.
    5. Configure the baud rate, packet size, stop bits, and parity bits according to the specifications of your instrument.
    6. Click Validate to ensure the settings are supported by the instrument.
    7. If you are using RS485, select the Advanced tab and ensure the Transceiver Mode is set correctly.
    8. Click the Save button to save your settings.
    9. Click Open VISA Test Panel to begin testing communication to the instrument.
      1. In the Test Panel window, select Input/Output.
      2. In the Basic I/O tab, enter a supported command and select Query. Refer to your instrument’s documentation for supported commands.
      3. The display window outlines the write and read operations.
  • If you are using a GPIB instrument, complete the following steps:
    1. Launch NI Measurement & Automation Explorer (MAX) from your installed applications. MAX is installed when NI hardware drivers are installed.
    2. Expand the Devices and Interfaces option in MAX under My System to find your instrument control device.
      1. If you are using an Ethernet or LAN device, your device should appear under Network Devices.
    3. Once the instrument control device has been found, select it.
    4. In the Settings tab, configure the GPIB settings such as Primary Address, Secondary Address, I/O Timeout, and Enable Autopoling, according to the specifications of your instrument.
    5. Click Scan for Instruments to detect an instrument using these settings. If you have a SCPI-compliant instrument, it should be detected.
    6. After it is detected, your instrument appears under the GPIB device in the configuration tree. If your instrument is not detected, visit the Can’t See GPIB Instrument Using Scan for Instruments In MAX KnowledgeBase article for troubleshooting tips.
    7. Test communication by selecting the instrument and clicking Communicate with Instrument.
      1. This will open a window to send various commands to the instrument and display the response..
      2. Instruments have different commands that they accept and run, which is typically provided in the instrument’s documentation. A common command is the *IDN? command, which asks the instrument to identify itself.
      3. Click the Query button and confirm the response from the instrument listing some details about itself.


You’ve now configured your instrument control device and run a sample communication. In the next section, we’ll take a measurement and confirm everything is working with your instrument control device.


Return to top

Take a Measurement

Step 5.

Your instrument control hardware should now be configured. Next, we'll learn how to communicate with your instrument in LabVIEW using the instrument control hardware. Watch this video or follow the instructions provided.

2:58

This procedure assumes you're using a GPIB instrument with an instrument control device connected to a development computer.

If you’re using a serial or other type of instrument, you can run the corresponding type of LabVIEW example. 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 GPIB, and find the Simple GPIB example.
  3. Configure the VISA GPIB Resource.
    1. From the dropdown list, you can select any of the instruments that were configured in MAX.
    2. The resource name will be an indication of the GPIB address, such as GPIB0::1::INSTR.
  4. This example runs the *IDN? Command and returns the response. Most instruments respond to this command, and if the instrument is SCPI-compliant, it will correctly interpret this command and return a response.
  5. Click the Run button and confirm the response from the instrument.


You should now have your instrument control device set up, configured with LabVIEW, and communicating with an instrument. Refer to the following links for more resources to support LabVIEW development and instrument control hardware.


Return to top

Where to Go Next

Resources

To continue learning about using Instrument Control Devices with LabVIEW, NI provides you with a number of options.

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

Return to Getting Started