Tektronix LabVIEW User manual

Programming Tektronix OpenChoice Oscilloscopes with LabVIEW

Introduction

LabVIEW is a graphical development environment for acquiring, analyzing and presenting data. This makes it a good companion to your TDS OpenChoice oscilloscope with its own data acquisition and analysis abilities.
You use LabVIEW to create virtual instruments, also known as VIs. A LabVIEW VI consists of a front panel and a block diagram.
The front panel provides the user interface for your program. Use the front panel to input data and view outputs. Build the front panel with graphical representations of controls and indicators. A control could be a knob or a switch. An indicator could be a graticule on which to display oscilloscope-style waveforms.
The block diagram contains the VI’s underlying code. Build your block diagram with functions, other VIs and wires. The wires connect the block diagram objects to each other. You can draw upon LabVIEW’s libraries for data collection, analysis, presentation, and storage.
Tektronix Software Developers Kit – Articles (001136701)
1
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
To help you create and edit your program’s front panel and block diagram, LabVIEW provides palettes. These are shown in the following table:
Palette Appearance Description
Tools
Controls
Use this palette with both the front panel and the block diagram. The tools in this palette let you operate and modify the front panel and block diagram objects. To display this palette, go to the front panel or block diagram menu bar and click:
Windows -> Show Tools Palette
Use this palette with the front panel. It provides your front panel’s controls and indicators. To display this palette, go to the font panel menu bar and click:
Windows -> Show Controls Palette
Functions
Use this palette with the block diagram. It provides your block diagram’s functions and VIs. To display this palette, go to the block diagram menu bar and click:
Windows -> Show Functions Palette
2
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)

Programming Options

Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
The functions palette includes oscilloscope-specific sub-palettes for each of the TDS5000, 6000, 7000, and 8000 series open Windows oscilloscopes. You can use them to manage waveform transfer between your LabVIEW applications and your TDS open Windows oscilloscope.
You can use either VISA I/O functions or VXIplug&play instrument drivers to communicate with your oscilloscope.
Advanced users can use VISA to send and receive text-based messages to the oscilloscope directly. You may want to use this method if you need complete control of how the instrument is programmed. This method has a higher learning curve than using an instrument driver. However, there are some opportunities for optimization if you are familiar with the GPIB command set.
Most users should use VXIplug&play driver to access all the oscilloscope functionality from LabVIEW. Tektronix has worked with National Instruments to provide LabVIEW wrappers that are customized for all Tektronix OpenChoice oscilloscopes. Note that the instrument drivers have to be installed after installing LabVIEW. These LabVIEW wrappers provide a convenient way of accessing the different functions in the driver. You can access these wrappers from the Functions-> Instrument Drivers palette as shown in the following illustration:
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
3
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
These VIs communicate with the oscilloscope through the standard Tektronix VXIplug&play instrument drivers and simplify tasks, such as transferring waveforms, timing and scaling information to and from LabVIEW.
The oscilloscope specific VIs simplifies these tasks by grouping related operations. For example, The Simple Get Waveform VIs can acquire waveform signals from a live source such as a channel, reference or math source or from a file. This article provides step-by-step instructions on building an example using these oscilloscope specific VIs.
Another option for communicating with your instrument is to use ActiveX. You can work with TVC and IVI-COM drivers using the ActiveX support provided by LabVIEW. An article in the SDK (Using the TekScope IVI-COM Driver in LabVIEW) provides step-by-step instructions on how to set up a sample VI in LabVIEW using a Tektronix IVI-COM driver. Unlike the Plug and Play drivers, customized wrappers are not provided for Tektronix IVI-COM drivers.
4
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW

A Simple LabVIEW Demo

The purpose of this demo is to familiarize you with creating a LabVIEW virtual instrument on your open Windows oscilloscope. The input is a simple probe compensation signal. The output is a graph of that signal. The demo assumes that you have an open Windows TDS5000, 6000, 7000 or 8000 series oscilloscope with LabVIEW installed on it, and a cable connecting your oscilloscope’s probe compensation signal to channel 1. Press the oscilloscope’s front-panel AUTOSET button to obtain a clear view of the probe compensation signal. Minimize the oscilloscope application.
a. Start LabVIEW from Windows by clicking on: Start -> National Instruments -> LabVIEW 6.1 -> LabVIEW
You should see a LabVIEW window, as shown in the figure to the right.
b. VI Creation
Click the button labeled New VI. This brings up a blank front panel and a blank block diagram, as shown to the right.
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
5
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
c. Front Panel Creation
Create your virtual instrument user interface. In this demo, you will do that by creating a front panel with an oscilloscope display on it. To do this, click the front panel’s menu bar,
Window->Show Controls Palette, as shown to the
right.
This will bring up the Controls palette.
Then select the Graph icon in the palette. This brings up the Graph sub-palette.
Click on the Waveform Graph control from the sub­palette. Then click the front panel to place the Waveform Graph on the front panel, as shown to the right.
Move the indicator in your front panel as desired. To do that, bring up the Positioning tool
pull-down menu on the front panel window. Click positioning icon in that palette.
. Do this by selecting Show Tools Palette from the Window
6
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
Use the positioning cursor to position the Waveform Graph as you want on the front panel window.
d. Block Diagram Creation Create your instruments’ underlying code by developing the block diagram. On
the Block Diagram window’s menu bar, click Window-> Show Functions Palette to bring up the Functions palette. Click Instrument Drivers item in the palette to bring up the Instrument Drivers palette. It should contain an icon for your series of TDS open Windows oscilloscope.
Put the VIs for the oscilloscope functions you want to use on your block diagram. In this demo, we are using four VIs to demonstrate waveform data capture from an instrument. The four VIs are Initialize, Get Horizontal Record Length, Get Waveform, and Close. To do this,
click each of these functions in the drivers palette and then click on your block diagram, as shown in the following figure:
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
7
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
You can further position the function blocks with the position tool from the Tools palette.
e. Set Values Now define a constant of a function to set. Do this by first selecting the Wiring
tool from the Tools palette. Then move it to the input (left side) of the Initialize VI labeled reset device. Right-click your mouse and select Create-Constant from the resulting menu, as shown in the following figure:
8
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
Now set the value of that constant. Do this by selecting the Operating tool from the Tools palette.
Then click on the reset device constant. Set the value to F, for false. Now, set another value. Once again select the Wiring tool from the Tools
palette. Then right-click the VISA resource name input on the left side of the Initialize VI. Select Create-Constant from the menu. If GPIB8::1::INSTR does not appear, check that your TekScope application is running. You can specify any other valid VISA resource name in place of GPIB8::1::INSTR.
You have now added all the VIs (objects) on your block diagram needed to process the data.
f. Wiring the VI The next step is to enable the VIs on your block diagram to communicate with each other. To do this, use the Wiring tool from the Tools palette.
Select the Wiring tool. Wire the following connections:
1. Connect the Instrument Handle Out terminal of the Initialize VI to the
Instrument Handle In terminal of the Get Horizontal RecordLength VI.
2. Connect the Instrument Handle Out terminal of the Get Horizontal
RecordLength VI to the Instrument Handle In terminal of the Get Waveform VI.
3. Connect the RecordLength Terminal of the Get Horizontal RecordLength VI
to the Waveform Size Input of the Get Waveform VI.
4. Connect the Waveform output terminal of the Get Waveform VI to the
Waveform Graph indicator terminal.
5. Connect the Instrument Handle Out terminal of the Get Waveform VI to the
Instrument Handle terminal of the Close VI.
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
9
Programming Tektronix OpenChoice Oscilloscopes with LabVIEW
g. Running the VI The last step is to start the program. To do this, simply click on the Run button.
In this demo, a waveform should then appear on the front panel waveform indicator, as shown to the right.
10
Tektronix OpenChoice Software Developers’ Kit – Articles (001136701)
Loading...