Getting Started with Test Automation in LabVIEW
As the number of interfaces and functionality integrated into devices under test continues to increase, automated testing becomes more valuable as a tool to cover more test requirements in less time. High-speed serial interfaces (HSSI) are no exception. Thankfully, most of the tests and measurements for HSSI can still be accomplished by oscilloscopes. In this article, we are going to describe three steps to get started automating oscilloscopes in LabVIEW. The Tektronix 5 Series B MSO oscilloscope will be used in this example, but the steps described in the application note apply to other Tektronix and Keithley products.
Three Steps to Automating Tektronix Oscilloscopes in LabVIEW:
1. Install software and driver.
2. Set up instrument driver.
3. Start measurement with a built-in example.
Install Software and Driver
1. Download and install LabVIEW if you haven’t yet.
2. Download and install the latest NI-VISA (NI-VISA is a general-purpose instrument driver required to automate the oscilloscope within LabVIEW).
Setting Up an Instrument Driver
1. Launch LabVIEW.
2. Select Help -> Find Instrument Drivers to launch Instrument Driver Finder.
3. Select Tektronix as Manufacturer and type “MSO” in Additional Keywords to narrow the search results. Click on Search.
4. Now the related Instrument Drivers are shown in the list. Select the one(s) that you would like to install, and then click Install.
5. Once the instrument driver installation is complete, the next step is to launch an example program.
Start Measurement with a Built-In Example
1. From the LabVIEW start screen, select Help -> Find Examples to launch LabVIEW Example Finder.
2. From LabVIEW Example Finder, select Browse -> Hardware Input and Output -> Instrument Drivers -> LabVIEW Plug and Play. A list of examples that are relevant to the installed instrument drivers is displayed.
3. From the list of examples, select MSO5X Series Acquire Waveform.vi. Connect the MSO 5 Series oscilloscope through either Ethernet, USB, or GPIB connection.
4. Open the example VI which will display the Front Panel. The Front Panel is the User Interface portion of a LabVIEW script, while the source code is referred to as a Block Diagram. Before executing the example, select your instrument in the VISA resource name dropdown and then click on the Run button. The waveform captured from the oscilloscope now populates on the Waveform Graph.
5. To see the block diagram, click Window -> Show Block Diagram. The Block Diagram will look like the following figure. It is the graphical source code connecting to the front panel user interface design.
6. For this example, you will see the source code is relatively straightforward. It consists of primarily four functions from the Tektronix 5 Series MSO instrument driver. These are:
a. Initialize – establish communication with the instrument.
b. Auto Setup – configure the oscilloscope to evaluate all input waveforms for optimum conditions of displaying the waveforms.
c. Read (Single Waveform) – initiate acquisition of the channel and return the waveform from the channel.
d. Close – terminate the software connection to the instrument.
Next Step
LabVIEW Instrument Drivers provide not only built-in examples but also a set of application programming interfaces (APIs) that enable the user to control the instrument. The API can be found on the block diagram by right-clicking, Functions Palettes -> Instrument IO -> Instrument Drivers.
In general, Instrument Driver APIs have Initialize and Close as the default required functions. These two are for initializing the instrument connection and closing the connection cleanly, respectively. The rest of the APIs are grouped into the following categories:
1. Configure: Oscilloscope parameter settings such as sample rate, record length, and channel settings. The Configure palette also contains settings for oscilloscope measurements, clock recovery functions, and probe options.
2. Action-Status: Perform an action on the oscilloscope, such as enabling AFG or digital outputs, performing deskew, or querying the instrument status.
3. Data: Reading measurement data from the oscilloscope. This palette includes functions for fetching a waveform, reading the digital voltmeter, or reading measurement results.
4. Utility: Utility functions such as resetting the instrument, executing a self-test, or querying the instrument for errors.
If you are interested in learning more about the Instrument Driver APIs, the VI Tree is a special non-executable VI providing a hierarchical overview of all functions contained within the Instrument Driver API. The VI Tree is one of the easiest and fastest ways to find a necessary function.
Leave a reply