VI High 21: How to Program a Tektronix DPO/MSO/MDO 2000, 3000, or 4000 Series Oscilloscope with LabVIEW - Part 2: Exploring the instrument driver, finding examples, & recognizing the scope in MAX
This episode picks up where VI High 20 left off, after finding and installing the instrument driver. Start there or go to sixclear.com/tek for the full, free tutorials.
In this episode we’ll explore the structure of the instrument driver through the VI Tree and the driver palettes. We’ll then look at how to find LabVIEW examples that work out of the box and then start to take a look at how to recognize our instrument in MAX.
Visit sixclear.com/tek for 30+ minutes of video tutorials on programming this scope.
Experience level: Basic
(start transcription)
“The most helpful place to start is at the VI tree. This is a non-executing VI purely used for documentation. I’ll go to the block diagram and I can see the programming flow for this scope, so I’ll use VIs in this order in order to build my code. First, I’ll initialize communication with my device, then I’ll use one or more of these configuration VIs to configure the scope according to my application needs. Context Help is especially valuable, Ctrl+H, as I can see helpful information about these VIs as I hover over them. So I see how to configure an individual channel, configure the timebase, the triggering, and so on. Notice that the description of the VI will tell me if it’s only to be used with a specific model series, for instance, the Configure RF Squelch VI can only be used with the MDO Series Oscilloscopes, and Configure Glitch Capture can only be DPO and MSO 2000 Series scopes. I have a couple VIs that fall into the Action/Status category, like storing a waveform and sending a software trigger,and then a few more VIs that have to deal with handling the data. The ones at the top are higher-level, meaning that they’re more abstracted and easier to use and below them we see the Low Level VIs that give us more control over the data acquisition and handling, but require a better understanding of how to program the device. Then we have a few optional Utility VIs, like performing self-tests and resetting the scope. Finally, I’ll close communication with the scope with this Close VI.
So we’ll close this VI tree. If it asks me to save, that’s fine, it just means I opened up this driver in a version of LabVIEW later than the one it was originally developed in. So I’ll just hit save so I don’t get this dialog box again. And let’s go back to the palette and see that it’s arranged in the categories we just explored: configure, action/status, data, utility and so on. Let’s delete this VI tree. LabVIEW asks if I want to save these according to the updated version of LabVIEW, again because my version of LabVIEW is later than the version in which they originally developed. So I will Save All.
And now, to get a good feeling of how to use this driver, let’s take a look at some examples that were installed with the driver. So we’ll go to the LabVIEW Example Finder here in Help»Find Examples. Staying on the Browse tab, we’ll go to Hardware Input and Output»Instrument Drivers»LabVIEW Plug and Play. Here are all the examples installed with the various instrument drivers on my machine. So we’ll scroll down to the Tektronix DPO MSO 2000 4000 Series examples. I’ll click on the first one and get some information about it. It uses autosetup to continuously acquire a waveform from a single channel. That’s pretty simple so let’s open it up and take a look at it. I’ll go to the block diagram, and here we see several of those VIs we saw in the VI tree: initialize, do an auto setup, acquire data continuously in a While Loop, and then close communication when we’re finished.
So let’s run this to see what happens. Before we can run it we need to identify the VISA Resource Name. What does this mean? NI-VISA is the underlying National Instruments driver that recognizes all non-National Instruments devices connected to our machine. For more information on VISA, the architecture of an instrument driver, and how they interact with our operating system, check out VI High, Sixclear’s LabVIEW programming blog. Specifically, episode 12: How to Install an Instrument Driver in LabVIEW.
Now, where can we see these VISA resources? The best place to go would be the Measurement and Automation Explorer, or MAX, that installs with NI-VISA. If you can’t find MAX in your Windows Start Menu, then make sure NI-VISA is installed by going to ni.com/drivers.
Now we’ve launched MAX and we’ll look to the left under My System. Now the scope that I’m using is connected to my computer using a USB cable. If we expand Devices and Interfaces, we’ll see all the devices and interfaces connected to my computer. One of them is this MDO4104-6 which NI-VISA is naming by default - this, which tells us the interface, USB, some unique hex character identifiers, and finally that it’s an instrument - INSTR. Now this is how it will be referenced in LabVIEW, and that’s kind of pain so I will rename this by right-clicking and giving it a meaningful alias, in this case MDO_Scope because we can’t have spaces. I’ll click Save and we see the name has been updated.”
(end transcription)