NI-VISA Overview

Overview

This document gives an overview of NI-VISA, the NI implementation of the Virtual Instrument Software Architecture (VISA) API.


NI-VISA is an API that provides a programming interface to control Ethernet/LXI, GPIB, serial, USB, PXI, and VXI instruments in NI application development environments like LabVIEW, LabWindows/CVI, and Measurement Studio. The API is installed through the NI-VISA driver.

 

Contents

VISA Advantages

NI-VISA is recommended because of the following three advantages.

1.  Interface Independence

NI-VISA uses many of the same operations to communicate with instruments, regardless of the interface type. This makes it easy to switch interfaces and provides a single language to learn for multiple different instruments. For example, the VISA command to write an ASCII string to a message-based instrument is the same whether the instrument interface is serial, GPIB, or USB.

2.   Platform Portability

NI-VISA is designed so that programs written using VISA function calls can move from one platform to another. VISA does this by defining its own data types. This ensures your application performs consistently across different platforms. Therefore, a VISA application written in LabVIEW can be easily ported to any platform that supports LabVIEW. NI-VISA supports several operating systems, including Windows OS versions, MacOS versions, and Linux distributions.

3.   Ease of Use

NI-VISA is an extremely easy interface to learn. It provides an API that has bus-independent functions for most of its I/O functionality. The most used functionality for instrumentation is provided in a compact command set, eliminating the need to learn low level communication protocols for multiple interface types.

VISA Terminology

Before you start using NI-VISA, it is helpful to learn some of the terminology commonly used throughout the development process.

VISA Resource

A VISA resource is any instrument in your system. If you have multiple instruments connected to one host, each instrument is considered a VISA resource. The resource is a complete description of the set of capabilities for the instrument.

The VISA resource type will depend on your instrument. There are several types: INSTR, SOCKET, RAW, etc.

 

VISA Resource Name (Instrument Descriptor)

The VISA Resource Name is the exact name of the VISA resource. It specifies the instrument interface type, the instrument address, and the VISA Session type. The VISA resource name control is used to communicate with the instrument in your development environment. Use this information to see if your instrument is recognized and addressed properly in your program.

 

VISA Session

A VISA session is a path of communication to a VISA Resource. A session is opened using the operation viOpen(). You must open a VISA Session any time you want to perform VISA communication to an instrument.

 

VISA Alias

A VISA alias is the nickname for a VISA Resource. The alias provides a friendly name to easily identify an instrument.

Typical VISA Application

A typical VISA application would go through the following steps.

  1. Open a Session to a given VISA Resource.
  2. Configure communication settings on the given resource (set baud rates, termination character, etc.).
  3. Perform writes and reads to the instrument.
  4. Close the Session to the Resource.
  5. Handle any errors that may have occurred.

You would also follow this exact same format if the instrument was serial, USB, Ethernet, or any of the other interface types VISA supports. All you would have to change is the VISA Resource Name wired to the input of the VISA Open.

LabVIEW Example

This LabVIEW application opens a session to a GPIB instrument, performs a write of *IDN?\n, and reads the specified number of bytes from the device. For descriptions of each VISA function, refer to VISA VIs and Functions.

LabVIEW code snippet showing the virtual instrument software architecture implemented with NI VISA.

Visual C++ Example

 

Visual Basic Example

Downloading NI-VISA

For Windows and Mac operating systems, NI-VISA has its own separate download. For Linux operating systems, NI-VISA is bundled with other NI device drivers in one single download called NI Linux Device Drivers.

For more information on operating system compatibility, refer to the following:

Instrument Control Tutorials

Refer to the following instrument control tutorials based on instrument interface type for a step-by-step tutorial to communicate with your instrument.

Instrument Control Forum

NI also provides support through the Instrument Control Forum. Users can engage with a wider community by posting questions and sharing information.

Was this information helpful?

Yes

No