VI High 28: How to Use the Initialize Array Function in LabVIEW

We’ve been building and manipulating arrays with LabVIEW functions for the past several episodes. This time around we’ll look at building an array with the Initialize Array function and learn why it won’t be sufficient to build an array of random numbers.

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

Experience level: Basic

(start transcription)

Well it’s nice to be back. Last time, we really got into arrays. I mean look at this. We learned about all types of functions to manipulate arrays. If you didn’t see it, go check it out, and even the one before where we talk about creating arrays manually in LabVIEW. But this time, we’re not going to do it that way. Delete.

Instead, we’re going to let LabVIEW create our array, through two different ways. The first is easy. Go into here into the Array Palette, and go into Initialize Array. Let’s take a look. We have the element and the dimension size, so I’ll just create a constant off of this, and maybe put in a five. And then what size of array do I want? Create a constant. Let’s go with four. Create an indicator. Run it, and what do I get? A four-element array of the element five. Great. That’s pretty easy.

What if I want an multi-dimension array? Okay, just hover over the bottom of the Initialize Array function, till I get my blue resizing dots, click and drag, and I expose another input. So I create constant off of that. I’ll put six in here. Create an indicator, and we get a 2D array. That’s what I thought. I run it. And there we go. An array with four rows and six columns. Now, I can repeat that process and change the size of the array, but as you can see, the array will always be all the same element.

But what if I want to change the elements in here? Make them different. Maybe I want an array of random numbers. How do I get that? If I want that array of random numbers, can’t I just replace this with a random number generator? Well let’s try it. Right click on it, replace it from the Numeric Palette, a Random Number Generator. There we go. I run it, and we do get a random number, but it’s all the same. And that makes sense because really this will generate one random number, since it’s called once, feed it into here, and, once again, we’ll create a four-by-six array of the same random number. The next time we run it, we’ll get a different random number, but all the same. How would I get an array of all different random numbers?

(end transcription)

VI High 27: Array Polymorphism and How to Use the Build Array Function in LabVIEW

In VI High 25 and 26 we started manipulating some 1D and 2D arrays with the Array Size, Add Array Elements, and Index Array functions. Now we’re going to take a look at array polymorphism and then the Build Array function. How do I combine two arrays in LabVIEW? How do I concatenate them? Watch and learn!

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

Experience level: Basic

(start transcription)

Now we’ve seen these functions change based on what we wire into them. Why do they do that? Well, that’s called polymorphism. That’s right, polymorphism. And if you take the CLAD exam, you’ll see it on there. Let me be explicit. Polymorphism. Look at how important that is.

It’s just the ability of the functions to change their functionality based on the inputs that are wiring in. Go ahead and look it up in the LabVIEW help, or check out the Sixclear LabVIEW Fundamentals course. We talk about it there. Anything else valuable in that array palette? Oh yeah, there’s a ton. A lot of it follows the same patterns that we’ve already seen with the Index Array, manipulating the rows and columns, changing the behavior based on what we wire in, so we won’t go into every one of these. The context help is pretty valuable.

But building an array is pretty common. I can pull that down here, and I can create a new array from a variety of things. So let’s say I want to combine these two arrays. To do that, I need to expose multiple elements, so I’ll hover over the bottom, click and drag, two elements, wire this 2D array into the top, wire this 1D array into the bottom.

What comes out? Well, we create an indicator, pull it down here, expand it a bunch, run, and we see these two arrays have been combined together, with this array being added to the bottom of the existing array coming from here.

Now what if I wired in two 1D arrays? Would it do the same thing? Well, it depends. Let’s get a little crazy and create a copy of this, take this array right here, which we know is this array, and then, take this array and wire it in. Create an indicator, and you see our resulting array is actually a one dimensional array.

Of what? Well, I’ll run it, and I’ll see the first two elements from here, and then all the rest of the elements from here. So what I’ve really done is concatenate the array. Take two 1D arrays, and put them end to end. In fact, if I right click on it, I see concatenate inputs is checked, whereas down here I see it’s not. It’s not even an option, because you can’t concatenate arrays of different dimensions.

But can I create a higher dimension array from this build array function? Yes I can. I can right click on it, uncheck concatenate inputs. Now, again broken wire because this wants to create a 2D array. I’ll delete that, create an indicator, there we are. Let’s get rid of some of this other stuff. CTRL-B to clean up the broken wires, run it, and there we go. The two 1D arrays have formed a 2D array. As you see, LabVIEW padded this first array with zeroes, because it wasn’t the same size. But that’s ok.

Well, that was really fun. What will we do next? Well, next episode we’ll go about creating arrays in LabVIEW where we haven’t already manually created them on the front panel or block diagram. So we’ll use the Initialize Array function, which is pretty easy, but we’ll also do some auto-indexing through loops. So, see you next time.

(end transcription)

VI High 26: How to Use the Index Array Function in LabVIEW

In VI High 25 we were manipulating some 1D and 2D arrays with some simple functions. Now we’re looking at one of the most common array functions: Index Array. How do I grab a single element out of a 1D array? Or a row/column out of a 2D array? And what is array polymorphism? It’s time to take a couple minutes and find out.

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

Experience level: Basic

(start transcription)

One of the most valuable is the Index Array function. I’ll put it down here. Why is it valuable? Well, let’s say in my code, I want to get ahold of this element and use it, maybe to multiply by another value. How do I get that out of that array?

Well, that’s the Index Array function. I take my array, wire it into the Array Input, and below I see the Index Input. Create a constant, and what number am I going to put in here? Remember that array is zero indexed, so zero, one, two. I’ll put in a two. Create an output. Run it, and indeed, there’s my value.

What happens if I take that same index array and wire a 2D array up to it? Look what happened: it changed. The context help can tell me what I’m seeing. It says it’ll return the element or subarray of a n-dimensional array. Hmm. Well, what if I were to go and put a zero in the top input?

You see I have Index Row, and Index Column. It says disabled, but that’s only because I don’t have anything wired into right now. So I’ll create a constant, and I’ll also make this two. Create an indicator, and I get a subarray out. Let’s take this subarray and pull it over here, run the VI, expand it over, and as we can see, what I’ve pulled out is this row - zero, first, second row -right here. Could I have also pulled out a column? Absolutely. I would have just wired this into the lower input.

And now look at the tip strip says Index Column, and then the row index is disabled. I run it, and indeed now I’m looking at the second column, right here. Can I go and just pull out one element from here? You know it. I’ll pull this down, hold down CTRL, click and drag to create a copy. LabVIEW auto-wires for me, and it also breaks a wire. Why does it do that?

Well, by wiring both inputs, I’ve essentially told the function that I’m going to specify both the row and column so that it should output a scalar value instead of an array. So I’ll get rid of this, and create an indicator. Let’s change this value to three, run it, so the third row down - zero, one, two, thee - and the second column over - zero, one, two - and there it is.

(end transcription)

VI High 25: How to use the Array Size and Add Array Elements Functions in LabVIEW

In VI High 24 we built some simple arrays. Now we’re going to take the next few episodes to look at some common array functions with 1-D and 2-D arrays. We’ve cut the episode length down to be bite-sized, digestible, and tasty. Bon appetit!

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

Experience level: Basic


(start transcription)

Hi, it’s been a while.

In our last episode, we took a look at creating arrays on the front panel and on the block diagram. In the two step process, first we put down an empty array shell and then we populated it.

So let’s start over here with Array Size. Put it down. The context help, CTRL-H, is always invaluable for knowing exactly what these do. Returns the number of elements in each dimension of the array. Well that’s cool. So I’ll wire this in here, create an indicator, pump up the output, I see it show up here. I run my VI, and indeed I have five elements in my array.

Now what if I wanted to know the value of all the elements added together instead of just the number of elements in my array? Well, for that I would go to the Add Array Elements function. Put that down. Wire this into here. Create an indicator as before, and run it. And here’s the sum of all these elements. That’s pretty cool.

What if I use this on a 2D array right here? Hold down control, click and drag this up, I’ll get rid of this for now, and wire the 2D array into the function input. Create an indicator. Oh, look what happened. I get an array as the output. I’ll expose two elements and run it, and I get two elements out. There are no more elements, just those. And as you can see, these elements correspond to the size of this array. Four rows. Five columns.

Before we move on, let’s take a look at these wires. First off, a scalar wire is pretty skinny. A 1D array wire is thicker, and a 2D array wire is thicker still. Look what I did. I made this a 3D wire, and it got a bit bigger. And you can guess if I run it and expose another element, yep, I have the size of each dimension. This other dimension is, as yet, unpopulated. You can think of it like multiple Excel spreadsheets. I’m looking at one, and here’s the other. But for now, I’ll hit CTRL-Z and go back, and take this back to two dimensions because we’d like to look at more functions.

(end transcription)

VI High 24: The Very Basics of How to Create an Array in LabVIEW

This is something you learn on day 1 of any LabVIEW course, including our Sixclear LabVIEW Fundamentals course (learn more at sixclear.com/labviewtraining). We’ll spend the following 3 VI High episodes continuing our discussion of these core array concepts.

Experience level: Basic



(start transcription)

“This VI High episode needs no preamble because everyone loves arrays.

So we’ll see first how to create arrays in LabVIEW and how to manipulate them.

So in LabVIEW, I’ll hit CTRL-N to open up a new VI. And then, I’ll tile them (CTL-T) side by side. Creating arrays is a two-step process. First, we put down an array shell, or array container, and then we populate it.

So, going to my front panel, I’ll right-click. Go to my array, matrix, and cluster palettes. Take an array shell. Put it down. On the block diagram, we can see that we have the array terminal, but it’s black, meaning it’s undefined at present. So it’s an array of what? Well, we need to put something in it.

So I’ll do something very simple, which is just create a numeric control. You see when I grab it, and I hover inside the array, I get these hashings along the edge. I click, and it autosizes around that, and now I’ve created an array of double numerics. Now, if I take my cursor and hover over the lower right, you see I get what looks like a little staircase. I’ll just click-and-drag this down and expose multiple elements in my array. Right now, I see that they’re grayed out because the array is uninitialized.

So, let’s say I come down right here and just put in any number. You see that these elements are no longer gray, and now I have a one-dimensional, five-element array.

Now what’s this right here? This is the array index. It shows the number of the element I’m viewing in the topmost place. So currently I’m viewing the 0-th element of the array. You can see if I increment it, I’m viewing different elements of the array. The 0-th, 1st, 2nd, 3rd, and so on.

So it’s handy, if I get back a massive array from data, and I have say six thousand elements, I can just double-click in here and type in whichever element I’d like to see. Maybe the four thousandth. If I do have that much data, it’s also handy to right-click on the border, go to visible items, and check the vertical scroll bar. Now, right now I don’t see a scroll bar because I don’t have enough elements. But if I come down here and create a few, then you can see that I can scroll through them like that. CTRL-Z to undo that.

So I’ve just created an one-dimensional array of controls. How do I create an array of indicators? Well, it’s pretty easy. I can just right-click on the border of the array and change to indicator. There we go. For now, I’ll leave it as a control, so I’ll do CTRL-Z. Now going back to my array, I have a one-dimensional array. How do I get more than one dimension? Well, maybe I just expand over again to the right, but it doesn’t look like I can do that.

So I have to go up here to the index display and I can hover over the bottom to this double-sided arrow, click-and-drag, and now I have two elements showing up. This means I’ve created a two-dimensional array. I can also right-click directly on the index display and add or remove a dimension right here.

For now, I’ll go click-and-drag this over here, and then hover over the lower right. Click-and-drag over here, and now I’ve exposed multiple elements of that array. So right now, I just have one row to add multiple rows, just as before. I’ll come down here and double-click, and there we go. I’ve initialized the array up to this point. And you see I have six rows and eight columns. That’s a pretty big array. As before, we can change what we’re viewing by manipulating the index display. The top index changes the rows. The bottom index changes the columns we’re viewing.

Now before we go further, I want to point out a common frustration that new LabVIEW users have, which is manipulating arrays with your mouse. In LabVIEW, a little bit of nimbleness with the mouse is recommended. So if I like to move this array around, I have to go and grab on the edge of the entire array right here. These resizing dots help me because they tell me what I’m actually moving or resizing. So if I hover over here, I see the blue resizing dots around the entire array shell. Perfect. I can click-and-drag. There we go.

However, we find that sometimes people want to move the array, and they grab an individual element like this. Then that de-allocates the array, and frustration ensues. Don’t do that. CTRL-Z will bring it back. Let’s move this over a bit.

Another common point of frustration is resizing the array. I’ll get rid of the vertical scroll bar first and reduce the number of rows by one. So if I want to, for instance, expose more elements of the array, I can hover over this blue resizing dot, click-and-drag, and multiple elements of the array occur. That’s good. But if I hover just inside of that, you can see now, I’m changing the size of the elements in the array. That can be frustrating. So just be aware of where you’re pointing this thing.

Now let’s head over to the block diagram and see how to create array constants. Creating an array constant is done pretty much the same way as creating an array of controls. First, I right click, head to the array palette, and put down an array constant shell. There it is as before: black, so it’s undefined. I’ll put something in it.

I’ll just go to my numeric palette, and this time I’ll put down an numeric constant which is an integer. Put that inside, and as before, I’ll hover over the lower right. Click-and-drag to expose multiple elements, put a value in to initialize the array, and expand the array elements just a bit so I can see them. Again as before, I go to the index and expand it to create a multi-dimension array, and then expand over to the right. Perfect.

Array constants are pretty handy, and we’ll see that they’re valuable for initializing files, architectures, providing dummy data types to certain functions to tell them what to output, and so on. There’s also a nice shortcut to create an array of constants if you have a comparable front panel array of indicators or controls. I would just go click-and-drag this over here, and now I’ve created an array of constants. It’s a copy of this. It’s not linked to it anymore. This is the terminal for that array. This is just a copy in constant format. So I’ll move it over here as before, drag it out, and you see the elements that I’ve already inserted. Likewise, I can go and take this array of constants, pull it over here, and I have an array of controls now.

We’re done for this time around, but next time we’re going to see how to programmatically manipulate these arrays. Because we’ve created them, but we really haven’t done anything. So stay tuned.

(end transcription)

VI High 23: LabVIEW 2011 New Feature - Wiring to the Error Cluster with an Or Function

So we want to stop a While Loop on error OR from a user clicking the Stop button on the front panel.

Before LabVIEW 2011, we used to have to unbundle the error cluster before wiring into an Or function going to the While Loop conditional terminal. Not anymore! See how it’s done in this quick video.

For more on programming in LabVIEW, check out the Sixclear LabVIEW Fundamentals course at http://www.sixclear.com/labviewtraining/.

Experience level: Basic

(start transcription)

“New in LabVIEW 2011 is a feature where we don’t need to explicitly unbundle the Boolean status from the error cluster. So instead of using the unbundle by name, I’ll just delete it, and wire the error cluster directly into the Boolean Or.

And LabVIEW is smart enough to pluck the Boolean Or out of this error cluster and use it for this Or comparison. Much easier.”

(end transcription)

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)

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)