Overview
This document gives an overview of National Instruments' implementation of the Virtual Instrument Software Architecture API, commonly referred to as NI-VISA. You can use NI-VISA to communicate with most instrumentation buses including GPIB, USB, Serial, and Ethernet. It provides a consistent and easy to use command set to communicate with a variety of instruments.
Table of Contents
History
For years industry has moved towards purchasing instrumentation from a variety of vendors. This allows engineers to choose the best instruments for their application without being constrained to a specific vendor. This caused the invention of hardware standards like SCPI that were designed to allow interoperability between instruments of different vendors.
Even with these standards in place, it was still a difficult task to build a test system with instruments from different vendors. In 1993 National Instruments, along with several companies including GenRad, Racal Instruments, and Tektronix, formed the VXIplug&play Systems Alliance. VXI was the standard at the time for modular instrumentation. The goal of the alliance was to ensure multi-vendor interoperability for VXI systems and to reduce the development time for a fully working system including multi-vendor instrumentation. VISA was developed through this alliance with hopes of increasing productivity through a decrease in system setup time.
Advantages of VISA
One of VISA's advantages is that it uses many of the same operations to communicate with instruments regardless of the interface type. For example, the VISA command to write an ASCII string to a message-based instrument is the same whether the instrument is Serial, GPIB, or USB. Thus, VISA provides interface independence. This can make it easy to switch interfaces and also gives the users who must program instruments for different interfaces a single language they can learn.

VISA is also designed so that programs written using VISA function calls are easily portable from one platform to another. VISA does this by defining its own data types. This prevents problems like, for example, possible problems caused by moving from one platform to another where the size of an integer may be different. In other words, a LabVIEW application written with VISA calls can be easily ported to another platform that supports LabVIEW. Several operating systems are supported, including Windows XP/64, Windows 2000/ME/98, MAC OS X/9/8, some Linux distrubutions, as well as some Solaris distributions.
VISA's greatest advantage is that it is an extremely easy language to learn. VISA provides a very simple-to-use API that has bus independent functions for most of its I/O functionality. VISA provides the most commonly used functionality for instrumentation in a very compact command set, eliminating the need to learn low level communication protocals for multiple bus types.
VISA Terminology
Before you start using NI-VISA it helps to learn a little terminology commonly used throughout the development process. The most important objects in the VISA language are known as resources. A VISA Resource is any instrument in your system (this includes serial and parallel ports). If you have multiple resources connected to one GPIB controller, each of those instruments is considered a VISA Resource.
An Instrument Descriptor is the exact name of a resource. It specifies the interface type (GPIB, serial, USB), the address of the device (logical address or primary address) and the VISA Session type (INSTR, Event, or INTFC). A VISA session is a path of communication to a VISA Resource, so you must open a VISA Session any time you want to do VISA communication to an instrument. A VISA Alias is basically a nickname for a VISA Resource. You could give an instrument located on [GPIB0::3::INSTR] a visa alias of "Function Generator". Then, in your application you could make calls to "Function Generator" instead of having to use the instrument descriptor.
A Typical VISA Application
A typical VISA application would go through the following steps.
1) Open a Session to a given Resource.
2) Do any configuration on the given resource (setting baud rates, termination character, etc...).
3) Perform writes and reads to the device.
4) Close the Session to the Resource.
5) Handle any errors that may have occurred.
The following is a LabVIEW application that opens a session to a GPIB Instrument, performs a write of "*IDN?\n" and then queries the device for its response.

This exact same format would be used in a text based language like C++ or Basic. You would also follow this exact same format if the instrument was Serial, USB, Ethernet, IEEE-1394, or any of the other buses VISA supports. All you would have to change is the Instrument Descriptor connected to the VISA Open. This code would run on any operating system that supports LabVIEW and NI-VISA.
Summary
NI-VISA is a software API that greatly reduces the development time of test and measurement systems. It gives developers the ability to easily create code to communicate with any instrument, over any bus, on most operating systems in use today. It also allows the generation of code that can be moved from one platform to another or from one bus type to another with little or no overhead in the change. This opens the door for creating hybrid systems that make the best and most cost effective use of multiple bus types all used in one test system.
NI-VISA is also kept up to date with new technologies as they release (like ethernet and firewire) so any test system developed with NI-VISA will be able to make use of the latest and greatest bus technologies available, while still leveraging previous technologies to provide a complete communication protocal for today's test and measurement system.
Reader Comments | Submit a comment »
Nice and short
It answered my query which was one of
these simple things that is obvious
when you know it.
Ed Long
-
Ed Long,Global Marine Systems.
ed.long@globalmarinesystems.com
- Dec 05, 2008
define acronyms
This article uses some acronyms without
defining them. That doesn't help a newbie
like me.
- Oct 27, 2008
This article should have the date it was
written (it is rather old and OK ).
It should also be pointing to a more in depth
handling of LabVIEW and VISA article.
And nowadays to instrument drivers and projects.
-
Albert Geven,Philips Research.
albert.geven@gmail.com
- Aug 22, 2007
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/).
