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)

[Flash 10 is required to watch video]

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)

[Flash 10 is required to watch video]

VI High 19: LabVIEW 2011 New Feature - How to Make Plots Visible on Charts and Graphs

Here is a quick and handy feature in LabVIEW 2011 that makes me smile every time I use it. Who wants their signal of interest buried in noise or under other signals? Not I. Now you can see those signals with a quick flick of the right-click.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course newly updated to LabVIEW 2011: sixclear.com.

Experience Level: Basic

(start transcription)

“In LabVIEW 2011, there are some handy features for viewing plots on charts and graphs.

So I’m going to go back to this and get rid of this Increment function, run it again, and we see that my plots are right on top of each other. Obviously they are separated by color, but what if I want to view just one? Do I have to change the code? Well, in LabVIEW 2011, no. I’m just going to expand the plot legend, so I can see plots 0 and 1, and I can right-click on a plot, and choose to make it not visible. There we go. Now I can easily see plot 0, with plot 1 not there. Obviously, I can switch that around, too.”

(end transcription)

[Flash 10 is required to watch video]

VI High 18: LabVIEW 2011 New Feature - Type Def Improvements

A couple improvements have made working with Type Defs easier, simpler, more straightforward, and other redundant terms. Join us as we take a look at how to take advantage of these changes.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course newly updated to LabVIEW 2011: sixclear.com.

Experience Level: Basic

(start transcription)

“In LabVIEW 2011, there are a couple of handy changes to Type Defs.

So here’s my Main, containing my Vat Data Type Def. If I go to the block diagram of main, here’s my Type Def, and we see that in the upper left there’s this little glyph. Just to make a point of it, I’ll make a copy of this Type Def and disconnect it, so that this one has no glyph.

Additionally, another handy improvement in LabVIEW 2011 is the ability to create a Type Def from the block diagram. To demonstrate this, I’ll quickly create another cluster on the block diagram, maybe with a numeric, a Boolean, and a string.

Now previously, if I had wanted to make this a Type Def, I would have to right-click on it, Change it to a Control, then go to the front panel, and make it a Type Def because this Advanced option was not available. But as we can see, now it is. So I can just go to Customize, and right here, drop it down, and make this a Type Def.”

(end transcription)

[Flash 10 is required to watch video]

VI High 17: LabVIEW 2011 New Feature - How to Use the Application Builder Clean Command

Continuing on our exploration of new features in LabVIEW 2011, we’re now going to look at the new “Clean” command in the Build Specification menu.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course newly updated to LabVIEW 2011: sixclear.com.

Experience Level: Basic

(start transcription)

“There are a few new features pertaining to building applications in LabVIEW 2011.

One of them is the Clean feature in the Build Specifications menu. So going back now to this Relative Path, I can see that this is my destination directory for the build. If I build it, I can go look at it right here. This is our Vista test machine, so don’t judge. I can go to build, and here’s my executable, my INI file, the data, etc.

Now let’s say that I look at this and realize that something’s wrong. I run this or I want to change something. Well, I could go and clean all these out, delete them all myself. This is a relatively simple application, so this can be done, but for more complex applications, this could be a pain. If I go back to the relative path, right-click on it, and go to Clean, as you can see, that’s all gone. Then I can go back into my Build Specifications menu and reconfigure my edited options.’”

(end transcription)

[Flash 10 is required to watch video]

VI High 16: LabVIEW 2011 New Feature - How to Create a SubVI

We took a bit of a VI High summer vacation (stretching well into fall…) but we’re back with several new, shorter videos on new features in LabVIEW 2011. Our first one has to do with the improvements in creating subVIs.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course newly updated to LabVIEW 2011: sixclear.com.

Experience Level: Basic

(start transcription)

“In LabVIEW 2011, there are some improvements when you create subVI’s. So if I were to click and highlight this section of code, go to Edit, and then Create SubVI, my SubVI has been made.

I double-click, open up the front panel, and we see that we have a connector pane right here, with our connections already made. So if I click on the terminal, I see the corresponding object highlighted.

I can always change this pattern, so the default pattern in LabVIEW 2011 is 4x2x2x4. I can always right-click, go to Patterns, and see other available ones. Though, this is the recommended.

If I go to my block diagram, of course, I see the code, or the subVI. Right now, we just have Untitled 1 (SubVI), so I’ll go to Save, and I’ll call it, ‘Area of a Triangle subVI 2.’”

(end transcription)

[Flash 10 is required to watch video]

VI High 15 (2 of 2): How to Find and Replace Duplicates From Our Selected Random Array Elements in LabVIEW

In our last episode we made a simple VI to randomly select items from an array but we found that it was prone to finding duplicates. This time around we find out how to avoid those duplicates.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course offered by Sixclear: sixclear.com.

Experience Level: Basic

(start transcription)

“And note that the array that I use the Replace Array Subset with is the full array, not the one from which I had removed that element in question. I’ll wire the resulting array to the border, disable indexing on both of these For Loops, their output. And in the False case of the case structure, we’ll just wire this array through because we didn’t find a match and we’re not changing anything. Now we want these For Loops to keep running until they’ve run through all elements in the array or they’ve found a match. This is a perfect use case of a Conditional For Loop which is available in LabVIEW 8.5.1. and beyond. So I’ll right click on the border of the For Loop, Conditional Terminal, once again I’ll hold down Ctrl click and drag to create some space, and now I’ll wire this boolean to the Conditional Terminal. And we’ll do the same for the outer For loop. And disable indexing, we just want one value.

So what do we do now? Have we entirely fixed the duplicate problem? Well no, this implementation will fix a single pair, if we’re again invoking our poker terminology. But what about the two pair or 3 of a kind? Remember greedy Mindy. This implementation won’t address those problems so we need to take the entire array, after the replacement, and run it through the same process again. How do we do that? We’ll wrap these nested For Loops in a While Loop. Give some space, and we’ll use a shift register to send this array back to the beginning and run it through the same process again. So the input array will no longer come through this tunnel, but rather the shift register.

And what condition will stop the While Loop? We’ll know we don’t need to run the While Loop anymore when both of these For Loops stop running and they didn’t find a match, meaning that this wire will be false. So we’ll change the Conditional Terminal on the While Loop to Continue if True, wire that value to it, disable indexing, and so the While Loop will stop when the Boolean value is false. Now the output from here will be a set of 6 unique indices. So we’ll just drag this little block of code - Ctrl click and drag - over here, and make another output: Real Winners! Excitedly. And run it.

We see that we’re successful, by checking that, in the case where there’s a duplicate in the Winners list, like Santiago, it is replaced with a unique name in the Real Winners! list. Run it a few more times, we have two Xui Lis, and only one in the Real Winners list. Fantastic.

That’s it, this VI is ready for action, which it will see after 11:59PM CST on June 9 when the sweepstakes ends. If you haven’t entered yet, get to it by visiting the instructions at news.sixclear.com. And once again, good luck!”

(end transcription)

[Flash 10 is required to watch video]

VI High 15 (1 of 2): How to Find and Replace Duplicates From Our Selected Random Array Elements in LabVIEW

In our last episode we made a simple VI to randomly select items from an array but we found that it was prone to finding duplicates. This time around we find out how to avoid those duplicates.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course offered by Sixclear: sixclear.com.

Experience Level: Basic

(start transcription)

“When we finished VI High #14, we had pulled out some random names from our Name Array, but we noted that we often ran into duplicates and we said that we would be coming back to item 3 in our implementation plan to find and replace those duplicates. There are, again, a few ways to do this but remember the primary characteristic of our implementation should be: robustness.

Robustness.

Let’s first be aware of some of the characteristics of the duplicates. Sometimes we only get one duplicate, or in poker terminology, a pair. Look at Sarah. Sometimes we get two pair, like 2 Aruns and 2 Veronicas. And sometimes we get three of a kind or more, like greedy Mindy here.

So we need to search through this array of indices to find these duplicates. First let’s clean up this block diagram. Then let’s use a For Loop which we’ll auto-index with this array of indices, and we want to compare this element to every other element in the array, which means we’ll bring in the entire array and disable indexing. We’ll want to remove this element we’re checking from the array. And we’ll use the Delete From Array function to do so. The iteration terminal will supply the appropriate index. So now we’ll put another For Loop inside of this one and index the array without the element we’re checking and compare the element we’re checking to every element in here with an equal function. So is this equal to this. If it’s true, then we want to replace that element in this array that we’re checking. So within a case structure, we’re essentially going to duplicate this little block of code over here except we’re doing it for a single element instead of an array. So I hold down shift and click, click, click and then hold down Ctrl, click and drag them over here. This new element I just created is going to replace the element we’re checking, the index of which is here in this iteration terminal of the outer For Loop. And so we’ll use a Replace Array Subset. I’ll hold Ctrl, click and drag to give us more space, delete this auto wiring which wasn’t helpful, wire this array into here, disabling indexing. That’s the index, and the new value.”

(end transcription)

[Flash 10 is required to watch video]

VI High 14: How to Select Random Elements from an Array in LabVIEW

In this episode we are preparing to select the winners of our sweepstakes giveaway. What better way to make the random selection than a LabVIEW VI?
None.
Join us as we look at how to randomly select items from an array and how to avoid the pitfalls of this seemingly simple task.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course offered by Sixclear: sixclear.com.

Experience Level: Basic

(start transcription)

“Avid Sixclear paparazzi are already well aware that entry to our sweepstakes giveaway of six licenses of the Sixclear LabVIEW Fundamentals Online Course is days away from coming to a close. As such, we need a way to randomly select the six lucky winners from the eager entrant pool. What better way than LabVIEW?
Our task is well defined. We will have an array of strings with names of our entrants. From that array, we will randomly select 6 with LabVIEW. There are several ways to implement this, we’ve chosen the most hopelessly interesting.

We will implement a solution in the following manner:

1. Generate 6 random numbers
2. Scale the random numbers by multiplying them by the size of the name array, this will generate an array of indices that can be used to pull out random names from the name array
3. Check for and replace duplicate indices
4. Use the indices to generate an output array of 6 random names

Let’s head to LabVIEW and do it.

I’ve already created a multicultural array of names on the front panel that we’ll use. Generating the 6 random numbers is easy. Just put a Random Number function in a For Loop running 6 times and auto-index the output. That occurs by default. Now to scale those to the size of the name array, we’ll take an Array Size function and use the polymorphic attribute of the Multiply function to multiply the array and the scalar output together. Now these numbers coming out are extremely precise fractional numbers and we just want whole numbers corresponding to indices, so we’ll use the Round Toward -Infinity function. For now, we’ll skip step 3 and just use this array of indices to generate our output names array. We’ll auto-index this array into a For Loop and pass the index to an Index Array function. The array we’re indexing is the full Name Array, and we’ll want to disable indexing on this tunnel coming in because we want that full array. Each iteration of this loop will give us one of the selected names, so we’ll auto-index the output to generate the full list of 6 names.

If I run this a few times we see that this procedure does indeed work except that we sometimes run into duplicate indices as a result of rounding down each element. You can imagine that multiple numbers in this array could be rounded down to the same number and so we have duplicates. Obviously we have a small Name Array and so we’re more likely to get duplicates, but we need a robust way to find and eliminate those duplicates for any size array coming in. Remember, robustness.

And remember that until next time because we are out of it. Uh, that’s time, not robustness, still plenty of that. In the meantime, you can enter the sweepstakes until June 9, 2011, just check out the entry requirements on our news blog: news.sixclear.com.”

(end transcription)

[Flash 10 is required to watch video]

VI High 13: How to Use and Install Instrument Drivers in LabVIEW (part 2)

In this continuation of VI High #12, we look at the structure and programming methodology of a LabVIEW instrument driver. Who develops instrument drivers and how can we find the resources to help us understand and implement them well? Finally, we look at how to install the instrument driver when not using the Instrument Driver Finder.

For more on learning LabVIEW, check out the LabVIEW Fundamentals Course offered by Sixclear: sixclear.com.

Experience Level: Basic

(start transcription)

“By now, you’ve worn your F5 key to a nub refreshing VI High, waiting for the second part of our instrument driver session. It is here.

Last time, we looked how to use the Instrument Driver Finder to locate and install our instrument driver. Let’s take a closer look at that instrument driver: the Textronix AFG 3000 Series. The most helpful place to start is at the VI tree. This is a non-executing VI purely used for documentation. I go to the block diagram and I can see the programming flow for this instrument, so I’ll use VIs in this order in order to build my code. First, I’ll initialize communication to the device, then I’ll use one or more of these VIs to configure the waveform I’ll be outputting. Context Help is especially valuable, I see that I can configure a standard waveform to output, I can configure the output impedance, and so on. I have a couple VIs that fall into the Action/Status category, like enabling output and clearing the arbitrary waveform, and then a few optional Utility VIs, like performing self-tests and resetting the instrument. Finally, I’ll close communication with this Close VI.

How about some examples on how to use this instrument? Where the examples are located really depends on who built the instrument driver. Some instrument drivers are developed by the instrument manufacturer, some by third parties, essentially anyone can develop an instrument driver and submit it on ni.com/idnet. As such, they do vary in quality and technique. The instrument driver can place the examples in the LabVIEW Example Finder, sometimes you’ll find the examples right in the palette or here in the VI Tree. As you can see, this instrument driver places the examples in the Example Finder so let’s look there. I’ll go to Help»Find Examples. Under the Browse tab I’ll go to Hardware Input and Output»Instrument Drivers»LabVIEW Plug and Play and here I see all installed examples. Here are the examples for the Tektronix AFG 3000. I’ll grab a simple one to generate a standard waveform. Go to the block diagram, we see that these VIs follow the same programming flow as I saw in the VI Tree. Initialize, Configure, Action/Status, and Close. Delightful.

Now what if somebody tells me they have an instrument driver they’ve developed, or what if I download one directly from the manufacturer’s website, or ni.com/idnet. How do I get that instrument driver into LabVIEW? The first thing to do is shut down LabVIEW, then I’ll navigate to the LabVIEW folder in my computer’s program files. By default, this is stored in C:\Program Files, I have a 64 bit machine and install 32 bit LabVIEW - along with all the rest of my 32 bit applications - in this (x86) folder, then \National Instruments\LabVIEW 2010\ then the instrument library or instr.lib. Here I would place the driver. So, for instance, let’s say someone developed a driver for a MAS-345 DMM and they handed it to me on a USB drive. Here it is. I can drag it into here, and then restart LabVIEW. Once LabVIEW is restarted, I can navigate to the same place in the instrument driver palette and there it is.

That’s it for instrument drivers. As always, check out sixclear.com for more on LabVIEW training and check out VI High for the full video transcripts.”

(end transcription)