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.
NI-VISA is recommended because of the following three advantages.
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.
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.
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.
Before you start using NI-VISA, it is helpful to learn some of the terminology commonly used throughout the development process.
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.
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.
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.
A VISA alias is the nickname for a VISA Resource. The alias provides a friendly name to easily identify an instrument.
A typical VISA application would go through the following steps.
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.
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.
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:
Refer to the following instrument control tutorials based on instrument interface type for a step-by-step tutorial to communicate with your instrument.
NI also provides support through the Instrument Control Forum. Users can engage with a wider community by posting questions and sharing information.