Instrument Control in Linux Tutorial

Publish Date: Oct 16, 2019 | 16 Ratings | 3.31 out of 5 | Print | Submit your review

Overview

Many pre-programmed instrument driver APIs are available for interfacing with common devices from NI LabVIEW applications, NI LabWindows/CVI applications, or other C applications running on Linux®. In addition, when a specific instrument driver is not available or custom functionality is needed, NI-VISA software can be used to develop your own drivers and simplify communication across instruments connected via Ethernet, GPIB, Serial, or VXI controllers. This document explains how to install drivers for your National Instruments serial and GPIB interface hardware (if applicable), install NI-VISA software necessary for instrument communication, locate pre-programmed instrument drivers for use in Linux applications, and get started programming your own instrument driver using the NI-VISA API.

Table of Contents

  1. Installing Linux Drivers for Instrument Control Hardware
  2. Using the VISA Interactive Control (VISAIC) Utility on Linux
  3. Locating and Installing Existing Instrument Drivers
  4. Instrument Driver Development on Linux Using the NI-VISA API

1. Installing Linux Drivers for Instrument Control Hardware

To control your instrument on a Linux machine you will need to install NI-VISA, as well as NI-488.2 if you are using an NI GPIB device, and NI-Serial if you are using an NI Serial device. The Virtual Instrument Software Architecture (VISA) is a standard for configuring, programming, and troubleshooting instrumentation systems comprising Ethernet, GPIB, Serial, or VXI interfaces. VISA provides the programming interface between the hardware and development environments such as LabVIEW.

NI-VISA is the National Instruments implementation of the VISA I/O standard. In addition, NI-VISA includes software libraries, interactive utilities such as NI I/O Trace and VISA Interactive Control, and configuration programs through VISA Configuration for all your development needs.

Installation of NI drivers for Linux occurs through a downloadable software repository called NI Linux Device Drivers. For instructions on getting started, please visit Downloading and Installing NI Driver Software on Linux Desktop.

Back to Top

2. Using the VISA Interactive Control (VISAIC) Utility on Linux

NI-VISA comes with a utility called VISA Interactive Control (VISAIC) on Linux. This utility gives you access to all VISA functionality interactively, in an easy-to-use graphical environment. It is a convenient way to view available ports and get started developing instrument control applications. Note that this utility cannot be used to change settings on your instrument.

To launch VISAIC on Linux, use the NIvisaic command. When VISAIC runs, it automatically finds all of the available resources in the system and lists the instrument descriptors for each of these resources under the appropriate resource type. This information is displayed on the VISA I/O tab. The following figure shows the VISAIC opening window:

 


Figure 1. The VISA Interactive Control (VISAIC) Utility on Linux is a convenient way to view available ports and
get started developing instrument control applications.

 

Another utility, VISA Configuration, can be used to add and configure instrument interfaces in your system. To run this utility, use the visaconf command. The following figure shows the visaconf opening window:

 


Figure 2. The VISA Configuration utility can be used to add and configure instrument interfaces on your Linux system.

 

If your instrument is not initially displayed under the Resource Editor tab, you can use the Add Static button to manually add it to your system.

Back to Top

3. Locating and Installing Existing Instrument Drivers

While it is possible to use NI-VISA to communicate with an instrument directly, using instrument drivers can abstract the lower level details and accelerate software development. The NI Instrument Driver Network provides access to drivers for thousands of instruments many third-party vendors.

If you want to use an existing instrument driver in Linux, it must be a Plug and Play driver. Interchangeable Virtual Instrument (IVI) drivers run only on Windows operating systems. To download an instrument driver for use with LabVIEW on Linux, you must make sure it is packaged as a *.vi or *.llb file. You cannot open or install a *.exe instrument driver file on Linux.

To access the instrument driver VIs in LabVIEW, save the *.llb and menu files in the LabVIEW\instr.lib folder. You will now have access to the VIs from the Functions>>Instrument I/O>>Instrument Drivers palette. You can use these VIs to communicate with your instrument.

Back to Top

4. Instrument Driver Development on Linux Using the NI-VISA API

If an instrument driver does not exist for your instrument, you can use NI-VISA functions in LabVIEW or LabWindows/CVI to control your instrument. Make sure to have your instrument user manual available, because you will need to be familiar with the commands that your instrument responds to. Refer to the VISA API section in the following document: Instrument Control in LabVIEW Tutorial, for more help on using VISA in LabVIEW. You can access the VISA VIs from the Function»Instrument I/O»VISA palette in LabVIEW.

>> Return to the National Instrument Linux Portal

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit