VI High 22: How to Program a Tektronix DPO/MSO/MDO 2000/3000/4000 Series Oscilloscope with LabVIEW - Part 3: Acquiring Data and Configuring Channels

This episode picks up where VI High 20 and 21 left off, after exploring the instrument driver and getting the scope recognized in MAX. Start there or go to sixclear.com/tek for the full, free tutorials.

In this episode we’ll take a look at acquiring a signal from the scope and programming configuration parameters for optimal viewing. Visit sixclear.com/tek for 30+ minutes of video tutorials on programming this scope. 

For more on programming in LabVIEW, check out Sixclear LabVIEW Fundamentals at sixclear.com/labviewtraining.

Experience level: Basic

(start transcription)

Going back now to our example, we can drop down this VISA Resource Name and see the resources that we viewed in MAX. So we’ll choose MDO_Scope and we’ll leave the channel and timeout as default. Before clicking the run button let’s take a look at what we’re actually acquiring. In this case, we have connected channel 1 of the oscilloscope to a digital pulse train coming from the MDO demo board. That pulse train is running at about 1.25MHz and 3.5V peak to peak.

Going back to LabVIEW we’ll click on the run button and see the waveform here on the front panel. Alright, we’re acquiring our signals. Now we notice, going back to the scope that the settings I previously viewed have changed. So LabVIEW, through the instrument driver, is changing the settings of the scope and, even if I stop the LabVIEW VI, those settings are retained by the scope. So why were the settings changed? Because we’re using the Auto-setup VI here. As we see in the Context Help, this VI “Configures the oscilloscope to evaluate all input waveforms and determine the optimum conditions for displaying the waveform.” And admittedly, that looks pretty good.

So what if we want to set different configuration parameters for our incoming signal? Well let’s start programming a new VI somewhat similar to this but where we set our custom configuration parameters. So I’ll open up a new VI, go the appropriate instrument driver palette, and the first thing I’ll call is the Initialize VI, and I’ll create a control off of the VISA Resource input. I’ll also want to create a constant off the Reset input and set the Boolean to False. If I leave this true then the scope will be reset to default each time I run this VI, much like pressing the Default Setup button on my scope front panel. So you can imagine I adjust my panel display by hand on my scope a certain way to view my signal and then I run this VI and with a True going to Reset, then my scope display goes back to the default settings which are not my personally preferred settings for viewing my signal. If I leave that as False, it won’t do that.

Then I’ll go to my Configure palette and I see Auto-setup.vi, which is what the last example used, but this time I’ll choose Configure Channel.vi. I place it down and, looking at my Context Help, I see that the only bold, and thus required, input is the VISA Resource Name. And it gets this input from the VISA Resource Name Out coming from my Initialize VI. So we’ll wire these together and connect the error clusters as well to ensure proper error handling. My Context Help shows me what configuration settings I can edit. So let’s first choose something simple like Vertical Range. The default value is shown in parentheses, 10V. So I will create a control, double-click on it to go the front panel, and change the value to 2V. I’ll leave all the other settings as default, including the Channel which is channel 1, and then I’ll place down the Read VI from my Data subpalette. You see it has this dropdown menu at the bottom, we call this an explicitly polymorphic VI, and by selecting some item here, I am choosing the polymorphic instance. For now, we’ll leave it at Single Waveform since we’re only reading from one channel. I’ll connect up the wires and leave my Channel input as the default channel 1. Since I’m reading the data, I’m going to want to display it, so I’ll do that on a Waveform Graph that I find on the front panel. Make it a bit bigger. I’ll flip back to the block diagram and wire to the Waveform Graph from the Waveform Graph output. Finally, I’ll call the Close VI, wire it up and put down a Simple Error Handler from my Dialog and User Interface palette to appropriately handle errors. We see LabVIEW successfully completing our auto-wiring.

If I run my VI like this then I am only acquiring one finite set of data points, or record, with a default size of 10,000 points. If I want to, on the other hand, acquire continuously, it’s simple, I’ll just wrap a While Loop around the Read VI. So let’s move these over, hold down Shift, click and drag to keep them in the same access, and then go get a While Loop. I’ll need a condition to stop the loop, so I’ll right-click on the Conditional Terminal and create a control. This creates a front panel Stop button. It’s also a very good idea to stop the loop in the case of an error. To do that, I’ll pull up an Or function from my Boolean palette. I’ll delete the wire currently going to my Conditional Terminal from my Stop button. Move this over, right-click on that wire and clean it up, and then wire from the output of the Or function to my Conditional Terminal. Now I need to pull the error out of this error cluster, so I’ll take an Unbundle by Name function from the Cluster, Class & Variant palette, and wire the error cluster into the input and leave the Status as default, which is the Boolean in the error cluster indicating whether an error has occurred, then wire the output of the Unbundle by Name to the top input of the Or function, and now this VI will stop if I click on the Stop button or if an error occurs. Now, if I have LabVIEW 2011 and beyond I can actually just wire the error cluster directly into the top input of my Or function without using the Unbundle by Name. So I’ll do that. It looks a bit cleaner. So I’ll go back to my Front Panel, choose the VISA Resource Name, and run this, and I see the data continuously showing up on my Front Panel. That’s very pleasing.

Now if you were paying attention, you noted that earlier I said that the pulse train had a peak-to-peak amplitude of 3.5V but I just put my Vertical Range at 2V, so that means the waveform is being truncated and we can actually see that at the bottom. So I can always change the vertical range though I will need to stop the VI first since the new configuration is only being read and applied to the scope before the While Loop begins. So I’ll put this value back to 10V. Perfect.

I should also mention that while this is running continuously, I can go adjust the settings directly on the Front Panel of my scope, so here I am adjusting the vertical range, and here I’m adjusting the horizontal scale. It’s important to note that LabVIEW is not writing to those configuration values right now, it only wrote to them when I called the Initialize and Configure Channel VIs so they can be independently manipulated while I’m viewing them in LabVIEW.

(end transcription)

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)

VI High 20: How to Program a Tektronix DPO/MSO/MDO  2000, 3000, or 4000  Series Oscilloscope with LabVIEW - Part 1: Finding and Installing the Instrument Driver

Programming a Tektronix oscilloscope isn’t difficult, especially when you have a Sixclear video tutorial to walk you through the entire process. In this opening episode, we’ll see where instrument drivers are found in LabVIEW, then find and install the Tektronix DPO MSO 2000 4000 Series instrument driver. This is only a low-resolution preview of the full 30+ minute tutorial, all available for free in high-resolution at sixclear.com/tek.

Experience Level: Basic 


This video tutorial doesn’t apply to all Tektronix scopes. Make sure you have a DPO/MSO/MDO 2000, 3000, or 4000 Series Oscilloscope. Those listed below are all verified to work:

Models          Description
DPO2012       Digital Phosphor Oscilloscope
DPO2014       Digital Phosphor Oscilloscope
DPO2024       Digital Phosphor Oscilloscope
DPO3012       Digital Phosphor Oscilloscope
DPO3014       Digital Phosphor Oscilloscope
DPO3032       Digital Phosphor Oscilloscope
DPO3034       Digital Phosphor Oscilloscope
DPO3052       Digital Phosphor Oscilloscope
DPO3054       Digital Phosphor Oscilloscope
DPO4032       Digital Phosphor Oscilloscope
DPO4034       Digital Phosphor Oscilloscope
DPO4034B     Digital Phosphor Oscilloscope
DPO4054       Digital Phosphor Oscilloscope
DPO4054B      Digital Phosphor Oscilloscope
DPO4104       Digital Phosphor Oscilloscope
DPO4104B      Oscilloscope
DPO4104B      Oscilloscope
MDO4054-3    Oscilloscope
MDO4054-6    Oscilloscope
MDO4104-3    Oscilloscope
MDO4104-6    Oscilloscope
MSO2012       Mixed Signal Oscilloscopes
MSO2014       Mixed Signal Oscilloscopes
MSO2024       Mixed Signal Oscilloscopes
MSO3012       Mixed Signal Oscilloscopes
MSO3014       Mixed Signal Oscilloscopes
MSO3032       Mixed Signal Oscilloscopes
MSO3034       Mixed Signal Oscilloscopes
MSO3052       Mixed Signal Oscilloscopes
MSO3054       Mixed Signal Oscilloscopes
MSO4032       Mixed Signal Oscilloscopes
MSO4034       Mixed Signal Oscilloscopes
MSO4034B      Mixed Signal Oscilloscopes
MSO4054       Mixed Signal Oscilloscopes
MSO4054B      Mixed Signal Oscilloscopes
MSO4104       Mixed Signal Oscilloscopes
MSO4104B      Mixed Signal Oscilloscopes


(start transcription)

“This video tutorial was developed by Sixclear to help you to get started programming your DPO/MSO/MDO 2000, 3000, or 4000 series Tektronix oscilloscope with LabVIEW.

For this tutorial, we are using LabVIEW 2011 but you can be using as far back as LabVIEW 8.2 without any problem. I will be programming an MDO4000 series oscilloscope, specifically the MDO4104-6 but the programming pattern we explore will apply to any DPO/MSO/MDO 2000 or 4000 series scope. We are assuming that you have a basic understanding of how to program in LabVIEW. If you don’t, we highly recommend our Sixclear LabVIEW Fundamentals Course. Check it out at sixclear.com. It’s really good.

We’re going to take a look at installing the instrument driver for your Tektronix scope and then programming some simple applications with it. Now, for those of you who are taking on an existing project, you may find that the instrument driver is already installed in LabVIEW. So let’s take a look at where that would be found. We’ve launched LabVIEW and we’re at the Getting Started screen. Let’s open up a new, blank VI, go to the block diagram and right-click to open up the functions palette. Take a look at our Instrument I/O subpalette, and then at Instrument Drivers. Here are all the instrument drivers currently installed in LabVIEW. What we’re looking for is the Tektronix DPO MSO 2000 4000 Series instrument driver. If you don’t see that here then it’s time to install it.

The easiest way to install the instrument driver is to go to Help»Find Instrument Drivers. This launches the Instrument Driver Finder. It’s first looking for my login information. It found me, and addresses me by name. It’s just using my ni.com profile. If you don’t have an ni.com profile, it’s free, just go to National Instruments website and sign up so they can send you emails.

First, I’ll click on Manufacturer, browse through them until I find Tektronix, and then, in the Additional Keywords field, I’ll type in the name of our MSO 4000 series scope, the tkdpo4k instrument driver. Here we are. We see here that it requires a minimum LabVIEW version of 8.2. And under Models Supported we can see exactly which models work. Here’s my MDO4104-6. I’ll click on Install and the Instrument Driver finder makes the connection, installs the instrument driver, and then asks me if I would like to install another driver. No thank you, I’ll just start using this driver. We now come to this screen where we can open the project, open the palette, or take a look at some examples. We’ll be able to access all of these things later, so let’s close this and go to LabVIEW.

We’re back on our blank VI, so let’s make sure this instrument driver was installed where we expect. We’ll go back to my Instrument IO»Instrument Drivers and there it is, Tektronix DPO MSO 2000 4000 Series instrument driver. Delightful. Let’s explore it.”

(end transcription)