3. VISA and VISA Tools

History

At the time, where GPIB was the main physical communication interface, remote control applications communicated directly with GPIB hardware drivers. Then, the RS232 serial interface was introduced as a cheaper alternative to GPIB. Also here, applications communicated directly with the RS232 hardware drivers.
The situation got even more complex as LAN interface has become the standard in the computer industry. Test & Measurement instrument vendors have foreseen the potential LAN interface can bring to connectivity options for their instruments. However, using a third software interface for the LAN-connected instruments would bring more complexity to test and measurement applications.

Out of the motivation to unify the software interface, VXIplug&play Alliance introduced VISA standard (Virtual Instrument Software Architecture). Currently, the maintanance of VISA is done by the IVI Foundation. For the LAN interface, the TCP/IP-based protocol was named VXI-11. Later, came its improved version called HiSLIP. The last addition was support for the USB interface. The USB class of devices natively supported by VISA are called USB-TMC (Test and Measurement Class).

VISA structure

Bellow, is a list of the most important VISA functions:

Access and Search functions:

  • VISA Open Default RM - opens a new Resource Manager for all VISA remote connections.
  • VISA Find Resource / Find Next Resource - Find an instrument according given criteria
  • VISA Open / Close - opens and closes remote connection to an instrument.
  • VISA Set / Get Attribute - sets or reads a session attribute.

Input / Output functions:

  • VISA Write - writes a command string to an instrument.
  • VISA Read - reads a response string from an instrument.
  • VISA Clear - clears device input and output buffers.
  • VISA Read STB - reads instrument's status system summary byte called STatus Byte.

Below, is a picture showing different software and hardware layers involved in a remote-control task. The instrument is at the bottom, your application is at the top. The VISA layer shields your application from the specifics of the physical communication interface. One exception where you can bypass VISA is Telnet connection - see *Note1.

R&S VISA

VISA implementations come from different vendors, but they all must abide to the same VISA interface standard. In the following chapters we present VISA and VISA Tools from Rohde & Schwarz and National Instruments. Rohde & Schwarz VISA is available for download here:

1DC02: R&S®VISA description

R&S®VISA 5.8.5 Windows installer , older versions: 5.8.2 , 5.5.5

R&S®VISA 5.8.6 Mac OS X installer , older version: 5.5.6

New!!! R&S®VISA 5.8.6 Linux installer

VISA Tester Tools

VISA Tester Tools represent ready-to-use applications that allow connecting to your instrument, sending SCPI commands and reading responses. They provide a complete independent way to verify the communication with your instrument.

Rohde & Schwarz VISA tester tool is called RsVisaTester. You can find it in:
Windows Start Menu -> All Programs -> R&S VISA -> Tester 32bit/64bit

How do you tell VISA which instrument over which interface you want to connect to? All this information is coded into one string called Resource String that is passed into the VISA Open function. If you already know your resource string, you enter it into the Resource field. If not, you can use the menu item Find Resource.

Here are the most typical examples of the Resource Strings:

  • TCPIP0::192.168.2.100::inst0::INSTR - instrument is connected over LAN (VXI-11 protocol), its IP address is 192.168.2.100. The 'TCPIP0' identifies LAN-adapter index, if more than one are available. The part 'inst0' identifies the instance of an instrument in case of more logical instruments share the same IP address (e.g. R&S CMW). You can leave it out and use the shorter form TCPIP::192.168.2.100::INSTR
  • TCPIP0::192.168.2.100::hislip0 - instrument is connected over LAN (HiSLIP protocol), its IP address is 192.168.2.100. Similar to VXI-11, '0' at the end identifies instrument instance. See *Note2.
  • TCPIP0::192.168.2.100::5025::SOCKET - instrument is connected over LAN (RawSocket), its IP address is 192.168.2.100 and the port is 5025
  • GPIB0::20::INSTR - instrument is connected over GPIB interface, its GPIB address is 20. If more GPIB controller cards are available, you distinguish between them with the 'GPIB0', 'GPIB1', 'GPIB2' and so on... See *Note3.
  • ASRL3::INSTR - instrument is connected over serial interface COM3.
  • USB::0x0AAD::0x0119::022019943::INSTR - instrument is connected over USB interface (USB Test and Measurement Class), with Vendor ID 0xAAD, Product ID 0x119, Serial Number 022019943.

Assuming you already have the correct resource string, connect to your instrument by hitting the Connect button. Then, enter the string *IDN?\n into the command field and hit Write + Read, or Query which automatically combines Write + Read operations. For the '\n' character see *Note4. The result is the instrument responding with an identification string:

NI VISA offers the same options with its application NI MAX. In the left Tree-control branch Devices and Interfaces, you can search for your instrument or add a new one. The connection is established when you open VISA Test Panel. The Input/Output tab provides controls similar to the RsVisaTester:

VISA Trace Tools

Another advantage of using VISA is the ability to trace and log the entire communication with your instrument. The log contains information about every action you performed over VISA - every command you sent, every message you received from an instrument, plus timestamps of those actions and errors if they occur. You can analyze this log for errors, performance issuses or other problems you might be facing. If you cannot resolve the problem yourself, you can save the communication log into a file and send it to a colleague or to one of our experts in Rohde & Schwarz Customer Support. Our instrument driver plugin for LabVIEW allows for importing IO trace and quickly convert it into LabVIEW code (see Tip 2.1 in 1MA228 ).

Rohde & Schwarz VISA IO trace utility is called RsVisaTraceTool. You can find it in Windows Start Menu -> All Programs -> R&S VISA -> Trace Tool. Detailed description is available in the R&S VISA Manual placed in the same folder. RsVisaTraceTool logging the *IDN? query communication:

NI VISA trace tool is called NI IO Trace. You can find it in Windows Start Menu -> All Programs -> National Instruments -> NI IO Trace. NI IO Trace logging the *IDN? query communication contains more entries due to reading of several session attributes:

Coexistence of R&S VISA and NI VISA

R&S VISA and NI VISA (and others) can be simultaneously installed on one machine. Which VISA is actually used by your application depends on the application type:

  • 32-bit applications: NI VISA is always preferred. During the installation, NI VISA overwrites any existing visa32.dll (32-bit) file. R&S VISA installs the visa32.dll only if no other file with such name exists (defensive installation).
  • 64-bit applications: The IVI Foundation has solved the conflict for 64-bit VISA applications. 64-bit version of visa32.dll is maintaned by the IVI Foundation and switches between different VISA vendors based on settings in VISA Conflict Manager.

*Notes

*Note1 - Telnet and RawSocket connection

Rohde & Schwarz instruments support Telnet (Teletype Network) protocol for the cases where VISA cannot be used (very often on LINUX or embedded systems) or may not be used (e.g. A&D industry). If an instrument supports Telnet protocol for remote control, you can still use VISA to communicate with it. In that case, the connection is called RawSocket.

*Note2 - HiSLIP protocol

The HiSLIP (High-Speed LAN Instrument Protocol) is explained in more detail in the application note 1MA208: Fast Remote Instrument Control with HiSLIP , including list of the Rohde & Schwarz instruments supporting the HiSLIP protocol.

*Note3 - GPIB interface and R&S VISA

The vendor of your GPIB controller (PCI / PCIe / USB-GPIB) must match the VISA provider. If for example, you use NI GPIB controller, you have to use the NI VISA.

*Note4 - Termination Character '\n'

'\n' is a Linefeed (LF) termination character, hexadecimally represented as 0x0A. It serves as message termination character.

In case of RawSocket and Serial connection, for VISA Write operations you always have to terminate strings with the LF character, because that is the only way to tell the instrument that message has ended. To recognise the end of the response in VISA Read operations, you need to set the VISA attributes VI_ATTR_TERMCHAR_EN to TRUE and VI_ATTR_TERMCHAR to 0x0A. Otherwise, although VISA Read receives correct response, it finishes with timeout error since it still expects more bytes to arrive.

Some instruments require the LF regardless of the connection type. In any case, sending the message with the LF at the end is the most universal and always works properly.
According the SCPI standard, instruments must terminate responses with LF. In our example above, notice the LF at the end of the identification string response in the NI Visa Test Panel. RsVisaTester does not display white characters, but you can see them in the RsVisaTraceTool log.

International Website