labview tutorial part 1 - mz3r. · pdf filelabview tutorial data acquisition with agilent...

32
LabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Upload: vuongquynh

Post on 30-Jan-2018

255 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

LabVIEW Tutorial

Data Acquisition with Agilent34970A via RS-232

Part I

Page 2: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

• Please read and follow the instructions in this tutorial carefully. If you think you’ve messed something up, the easiest way to fix it for what we’re doing today is to start over. Simply close all your LabVIEWwindows, saving only your work, and exit LabVIEW; DO NOT save any changes you may have made to the built-in VI’s we’re using (such as HP34970A Initialize.vi). Then just start over… Good Luck!

Page 3: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I
Page 4: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

This is the Panel Window, where the user interface is built

Page 5: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

This is the Block Diagram or Diagram window, where the elements of the user interface are connected by the virtual instrument (VI) designer.

Do this…

Page 6: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Here’s the function palette. We’re looking for VI’s that have already been constructed for the Agilent 34970A. We’ll build a VI by piecing together other VIs.

Push this…

Page 7: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

The Instrument I/O button on the palette is where the 34970A VIs are located.

This is highlighted when you push this…

Page 8: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Continue to dig down through the functions palette …

Page 9: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

It’s easier to see it all this way; yours can look like this if you use a right click in the Diagram window. This brings up the functions palette but it doesn’t stick until you press the push pin. This way you can see the entire path down to the 34970A items. Let’s stick this last palette… after you look around in the Get Started and other buttons…

Page 10: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Now we’re ready to build our VI from the VI’s provided here.

Page 11: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

First let’s look at the big picture of what we’ll be building. We want to build a VI that will initialize the DAQ unit to make sure it’s OK, measure a value of temperature using a TC, and then release the box gracefully so that the next user or VI can access it. Pictorially, it would look something like this…

initialize measure T close up unit

Page 12: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

If you’ve looked through the 34970A palette, you’ve seen Initialize and Close VIs are available, and there are a couple of VIs that will measure Temperature.

Let’s start building our VI by placing an Initialize VI on our Diagram window. Because we’re using it like this, it now becomes a subVI in LabVIEW’s lingo…

Page 13: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

If you roll your cursor over the Initialize VI, you’ll see the terminals become visible. This is where the input and output information (input from the user interface and output to the user interface or panel) is passed to and from the VI. If you don’t see this, then you need to check the Tools palette.

Page 14: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I
Page 15: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Make sure that the Automatic Tool Selection is “On” so that LabVIEW will choose the proper tool for you. If you don’t like to give it this power, then to see the terminals, manually choose the Spool tool, which is for wiring terminals… Later on, we’ll need the Finger tool for using the Panel view of the VI we’ve created…

Page 16: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

As you can see from rolling over the VI, there are several inputs and outputs for which we need to provide interfaces. We could do this from scratch using the Functions palette; however, we could also rely on the work of others. Double click the Initialize VI; what happens is that a Panel window for that VI appears. We can then use the interfaces we need from that simply by copying and pasting them into our Panel window. Let’s do this…

Page 17: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Here’s what we see after double clicking the Initialize VI…NOTE: Pay attention to the following; this is a common mistakeWe don’t want to alter any values yet; we just want to copy them to our VI. I’ll let you know when we want to change the values and how to do that !

Page 18: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

To copy the interfaces, simply click and drag your cursor as is typical for W2k and then select Copy from the edit menu. (Yes Iknow it’s easier to use the right mouse button; try it and see what happens…)

Page 19: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Now I’ve pasted the user interfaces from Initialize to my VI to use. Simply select the Panel window and select Paste from the Edit menu. It looks nice, and that was easy, but now we need to look behind the scenes to see how these interfaces are connected, so we can see where the input information goes…

Page 20: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

As you can now see, the only thing it does is look, since these interfaces are not connected at all to the Initialize VI. However, before you panic, this is pretty easy to fix. We just want to position the interfaces where appropriate (say inputs on the left or input side of the VI), then connect them using the Spool tool.

Page 21: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Here, I’ve rearranged the inputs and outputs and am starting to hook them up. You’ll probably notice that I accidentally left one down there…

Page 22: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

As you’d probably expect now that you’re getting familiar with LabVIEW, when you roll over the Initialize VI, the terminals appear and the terminal names will appear if you stay on the terminal briefly. Just like in Kindergarten, you should match up the interfaces to the appropriate terminal…

Page 23: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

If you do it correctly, LabVIEW rewards you by coloring in your wire to let you know you wired it correctly. If you try to connect the interface to the wrong type of terminal, you’ll get a black dashed line, indicating a problem. If you place your cursor over the bad wire, you’ll get a message indicating the problem…

Page 24: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Here’s the Initialize VI wired up to it’s user interfaces. You don’t need to wire up the outputs, since we’ll be feeding the outputs to another VI for the Temperature measurement. If you’ve already done so, just eliminate the connections by double clicking the wire and deleting it.

At this point, you should probably save your work… Save only YOUR newly created VI by selecting Save from the File menu…

Page 25: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Remember what it is that we’re trying to do. Our big picture view is seen again below… Let’s find a VI that measures Temperature and connect it to the VI we’re building…

initialize measure T close up unit

Page 26: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Now we’re looking for the VI to measure Temperature. I’ve selected the Data button on the 34970A palette, as you see near the bottom. I’ve also turned on Context Help…

…which is accessible through the Help menu. The reason I’ve done this is it provides me with a description of the VIs I’m viewing as I look for my Temperature measuring VI. Roll your cursor over one of the VIs to see its description…

Page 27: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

So now let’s go through the procedure of adding the EZ Temperature VI and hooking it up. This is the same procedure we used for the Initialize VI… so you should be good at that by now

Maybe you should let someone else in your group try it…

Page 28: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Remember that we need to double click the EZ Temperature VI as the easy way to get to the needed user interfaces. I don’t need all of them… just the ones on the input of the EZ Temp VI that aren’t outputs from the Initialize VI… and a place to put the answer. Roll your cursor over the EZ Temp VI and look at the Context Help description of the inputs and outputs as on the previous slide of this presentation. This will help you figure out which parts of the interface you really need.

Page 29: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

Copy and paste the needed user interfaces from the EZ Temp Panel to your new Panel (not shown here…) and then come to the Diagram window (shown here) and do the necessary wiring…

Hook these up…

To this…

Page 30: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

I think you can take it from here. Add a Close VI to make your VI work gracefully. Your Diagram window should look something like this. Now use the Panel to run it to see if it works…

Page 31: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

The red arrows indicate input you should provide WHEN YOU RUN your VI from the Panel. (by the way, these inputs will be the same whenever you use LabVIEW with our 34970As.

Change this by placing cursor inside the box and typing…

Change this by using the Finger tool and the Scroll buttons to scroll through the values

And the blue arrow is where the answer is.

Page 32: LabVIEW Tutorial Part 1 - mz3r. · PDF fileLabVIEW Tutorial Data Acquisition with Agilent 34970A via RS-232 Part I

• Congratulations! You’ve just built a VI for interfacing with the DAQ unit for retrieving a value of Temperature and displaying it on the Panel.

• By the way, screen shots are made by selecting Alt-Print Screen, which copies the contents of the active window onto the clipboard. You can then paste these to MS Word for your documentation.

• Now let’s move on to use one of the Demo VIs…