VectorStar™ MS4640A SeriesMicrowave Vector Network Analyzer : Appendix B — Programming with LabWindows/CVI : Overview
 
Overview
Programming Basics
There are many cases where a user may want programmatic control of the VNA. Examples include automating a test sequence, manufacturing testing, orchestrating a complex measurement involving various pieces of test equipment, gathering a time series of data, or as a convenient way of getting data, files or images transferred from the VNA to a pc for further analysis.
GPIB Mnemonics
VectorStar has a fairly large set of GPIB commands. This includes a set of Native commands, Lightning commands and Agilent 8510 commands. You use the same commands regardless of the communication method employed. See Example 4 for using the LIST command to output the full set of supported GPIB mnemonics directly from the VNA. Because VectorStar supports Lightning commands we can use the VectorStar au464x LabWindows/CVI driver to control VectorStar but also send some Lightning commands if necessary. This document uses a combination of au464x driver functions and VISA Reads and Writes to send commands to the VNA and to get data from the VNA. With this combination method, we use the driver to accomplish many simple activities while the VISA commands allow a full range of command including VectorStar Native commands (see example 6). Thus the full set of VectorStar functionality is available to the LabWindows/CVI programmer.
What is VISA?
VISA (Virtual Instrument System Architecture) is an I/O software standard for communicating with test instruments like VectorStar over any of the bus architectures which VectorStar supports. A VISA driver is available from both National Instruments and Agilent. National Instruments VISA drivers are available for the following operating systems: Windows (all versions), Mac OS X, Linux, Mandriva, RedHat, SUSE, PharLap, VxWorks, Pocket PC 2003, and Windows CE/Mobile. It’s always a good idea to get the latest driver (Version 5.1.1). If you plan to also do lots of VISA programming, get the Full Version (not just the runtime) version 5.0 or higher for the best support of the latest .NET 4.0 Framework, USB and TCP/IP. The driver is available from http://www.ni.com/visa/ or from NI Device Driver CD that comes with NI hardware and is installed along with LabWindows/CVI. Most LabWindows/CVI drivers use VISA to communicate.
VISA uses connection strings to set up communication with the VNA over various protocols. Here are some connection string examples:
//VXI-11 Connection string
"TCPIP0::192.168.1.7::INSTR";
 
//GPIB Connection string
"GPIB0::6::INSTR";
 
//USB Connection string (vendor::product::serial_number)
"USB0::0x0B5B::0xFFD0::MS4647A-12345::INSTR";
The beauty of using VISA is that the only thing that needs to be changed for any of these possible communication protocols is the connection string. The rest of the code should be exactly the same (except for SOCKETS which are not covered in this document). For TCP/IP we recommend using VXI-11 since it better implements the IEEE 488.2 standard and all status checking. The Getting Started section of the Programming Examples shows how to set up for communication over VXI-11 (TCP/IP).
Programming Environments
Programming environments that are commonly used with test equipment include LabVIEW, LabWindows/CVI, Microsoft Visual Studio, Visual Basic 6, HP Basic, and so on. NI-VISA supports the following Windows development environments:
LabVIEW
LabWindows/CVI
Measurement Studio for Visual Studio (all versions)
Microsoft Visual Studio 2010/2008/2005/2003/6.0
Microsoft Visual Basic 6.0
For the examples below, we’ll use LabWindows/CVI Version 8.5 with the Anritsu VectorStar au464x LabWindows/CVI driver. We’ll interchangeably use the terms LabWindows/CVI and CVI. These both refer to the programming environment.