You are on page 1of 9

LAB II.

INTRODUCTION TO LABVIEW

1. OBJECTIVE
In this lab, you are to gain a basic understanding of how LabView operates the lab equipment
remotely.

2. OVERVIEW
In the procedure of this lab, you will build a virtual instrument (VI) utilizing LabView 2011. This
will be accomplished in a flow chart programming environment where you will have to connect
control blocks and virtual instruments (VIs) to build another virtual instrument. Specifically you
will construct a virtual instrument that will configure the function generator output, program the
oscilloscope to measure the output, and display the signal on the screen.
Information essential to your understanding of this lab:
1. LabView 2011 Tutorial
Materials necessary for this Experiment
1. Standard testing station

3. BACKGROUND INFORMATION
LabView is a programming environment that uses a graphical flow chart as the source code.
LabView allows us to control the instruments used in the EE 3110 labs. We can control all but one
of the instruments in this lab using the IEEE.488 bus. This includes the digital multi-meters, the
oscilloscope, the function generator and source meters.

In addition to controlling the instruments, LabView allows us to get the information recorded into
the computer where we can use a variety of math functions to alter it, fit it, analyze it using
statistical functions, plot it on a graph, and store it to a file. These capabilities allow us to focus on
the devices being studied, not on the mechanics of taking the measurements.

The beauty of LabView is its intuitive graphical environment. Creating VIs is easy because you
can think as if you are making an instrument. In the front panel programming window, you can
envision all the controls that you want on the front panel of your instrument. As you place them on
the front panel, they appear in the block diagram window. Now all you have to do is put in the
logic circuits to execute the commands and wire together your controls and your logic functions. It
has an extensive library of functions for controlling just about any GPIB (general purpose interface
bus) instrument available. This makes controlling and measuring data with the instruments as easy
as plunking down a downloaded VI and providing it with the correct inputs and outputs.

4. PREPARATION
Please review the online videos for LabVIEW to gain some familiarity with this software before
coming to class.

1. Go to the link Introduction to the LabVIEW Platform and watch a general introduction to the
LabVIEW software.

2-1
2. Next go to the link The LabVIEW Guided Tour and watch a second demonstration on how to
use LabVIEW to take measurements using benchtop instruments.
3. Record a few images from each presentation to a Word document by using Alt Prt Scr in order to
verify that you have watched the appropriate videos.
4. Print these images and submit them as your pre-lab work for Lab II.

5. PROCEDURE
IN THIS LAB CLASS, DO NOT SAVE YOUR WORK TO THE C DRIVE. Please use
your USB key memory only.

Introduction to the work environment


To create any Virtual Instrument with LabView, we need to work on two windows a block
diagram window and a front panel window. The actual components (also called as internal
functions) involved in the experiment are arranged in the block diagram window like in a
flowchart. The various controls required to operate the components are inserted and arranged in
the front panel window. The properties and the values of the various controls are updated in the
front panel window. Finally, the controls are linked to the components in the block diagram
window and wired suitably and then the design is debugged and then executed.

Example problem definition : Construct a VI that can set the function generators output
characteristics, including function (sine, square, triangle, or ramp waves, noise or dc) as well as its
amplitude, frequency and offset voltage. Then use the oscilloscope to read the waveform into the
computer and plot it in a graph. When you are finished, your front panel window and block
diagram window may look something like Figure 1. Figure 1 is only given as an example. You can
do the wiring and arrange the controls in any pattern you desire.

a.)

2-2
b.)
Figure 1. Possible screen shots of the block diagram window (a) and the front panel window (b).

5.1. ACQUIRING THE INTERNAL FUNCTIONS


As you recall from the introduction, the internal parts of your VI are always placed directly on the
flow chart diagram. Make sure you are in the block diagram window. This is the LabView
window with the white background. If your functions pallet is not showing, select the Window
menu from the main toolbar in the Diagram window and then select Show Functions Palette.
This will make your functions palette appear.
Your first task will be to search through the menus of the functions palette in order to, find and
place the four instrument drivers needed to build your program. We would be using the
oscilloscope and the function generator in this experiment and the various function palettes we
would be using to operate these are given below.

a.) b.) c.) d.)


Figure 2. Functional blocks of the device drivers.

Figure 2 a) is the hp 33120a - Select Arbitrary Waveform.vi block or VI. This virtual
instrument allows you to configure the function generator to output a certain wave such as a sine
wave or a square wave. To find the hp 33120a - Select Arbitrary Waveform.vi driver see Figure
3.

"Instrument I/O >> Instrument Drivers" >> "HP33120A VIs" >> "Configure VIs" >> hp 33120a - Select
Arbitrary Waveform.vi
Figure 3. An example of how to find the hp 33120a - Select Arbitrary Waveform.vi after
selecting the Instrument I/0 menu from the Functions Palette.

2-3
Figure 2 b) is the hp 33120a - Config waveform.vi" block. This function block configures all the
parameters of the wave initiated by the hp 33120a - Select Arbitrary Waveform.vi block. In
other words, the hp 33120a - Config waveform.vi" VI allows you set the duty cycle, amplitude
units, DC Offset, Peak Amplitude, and Frequency. It may be found under the Configure VIs
menu along with the hp 33120a - Select Arbitrary Waveform.vi block.
Figure 2 c) is the "HP546XXX Autoscale.vi" block. This block executes the auto scale function
on the oscilloscope. To find the "HP546XXX Autoscale.vi" driver see Figure 4.

"Instrument I/O >> "Instrument Drivers" >> "HP546XXX VIs" >> "Configure VIs" >> "HP546XXX Autoscale.vi"
Figure 4. An example of how to find the "HP546XXX Autoscale.vi" driver after selecting the
Instrument I/0 menu from the Functions Palette.
Figure 2 d) is the "HP54600A/610B Read Waveform.vi" block. This block allows LabView to
read the wave on a selected channel of the oscilloscope. To find the "HP54600A/610B Read
Waveform.vi" block see Figure 5.

"Instrument I/O >> "Instrument Drivers" >> "HP546XXX VIs" >> "Data VIs" >> "HP54600A/610B Read
Waveform.vi"
Figure 5. An example of how to find the "HP54600A/610B Read Waveform.vi" driver after
selecting the Instrument I/0 menu from the Functions Palette.

Now that you are finished finding the drivers necessary for your virtual instrument, it is time to
design your control panel in the Panel window. However you should first take some time to
examine the driver blocks. In order to understand what these function palettes signify, we use the
context help box to help identify the inputs and outputs of these drivers. If the "Context Help" is
not already showing, select Help from the menu from the main toolbar in the Diagram window
and then select Show Context Help or press Ctrl-H . After examining each driver for its inputs
and outputs, switch to the Panel window.

5.2. BUILDING A CONTROL PANEL


Now it is time to program the front panel of your VI. You may either click on the Panel window
or press Ctrl-E to bring it to the front. We can observe from Figure 1 that we need four numeric
inputs to the waveform generator viz. Frequency, amplitude, duty cycle and DC offset and three
ring counters to provide options for the amplitude unit, the type of waveform and the oscilloscope
channel to be used. Examine Figure 6 to see an example of how to select these controls.

Modern >> Numeric >> Digital Control


a)

Modern >> Ring & Enum >> Text Ring


b)

2-4
Figure 6. The steps to select a numeric control or a ring control from the Controls
palette.

Before we continue placing controls, it important to know how to edit them. To change the
properties of any block, right click on them and a menu will appear with all the available editing
options. It will be necessary for you to modify the properties of your numeric controls and ring
controllers in order for your VI to function properly. Reference the two pop up menus of a numeric
controller (Figure 7 a) and of a ring controller (Figure 7 b). Changing different parameters is as
simple as clicking on these items and entering the data. For example, changing the way the
computer represents the controllers numbers may be done by moving your mouse over the
representation selection in either pop up window causing a second window to appear, providing
you the choice of four number formats with three bit lengths. The four formats are signed
integers(I), unsigned integers(U), floating point numbers(SGL, DBL, EXT) and complex floating
point numbers(CSG, CDB, CXT). You will have to do this in the subsequent lab.

a) b)
Figure 7. The pop up menus of a numeric controller (a) and a ring controller (b).

The Data Range, the Format & Precision function, and the Edit Item functions now reside
under the item Properties located at the end of each of these menus in LabView 2011. Edit
Item is used to edit the ring counters strings. The different states of the ring counters are visible
once you enter this pulldown. Each are associated with a different number given in sequence.
Simply click on these states and enter in an appropriate label to define a particular state. The
commands Insert, Delete, Move Up, and Move Down located under Edit Item are
further used to edit the states of the ring counters. The number of the state of the ring counter must
correlate with the number of the state in the VI to which the ring counter is inputting data.
Consequently, these state numbers are very important because they provide inputs to the VIs.
Later in the lab, you will have to use these commands to label the states of your ring controller.

Each state will have a number associated with it based on its location and the starting number of
the first state. In Figure 8 below the starting number is one, therefore the following states are two,
three, and four in the forward incremented direction. If the starting number was zero, the following
states would be one, two, and three in the forward direction.

2-5
1 2 1 2

4 3 4 3

Figure 8. The two directions of a four state ring counter. The solid (red) lines show the
current state of the ring counter when an increment is executed. The dotted (blue) lines
show the current state of the ring counter when a decrement is executed.

During this lab, we will select the state for all three ring counters and then execute the program
using these particular states. These states will indicate the type of amplitude unit you will use [Vpp
(Voltage peak to peak), Vrms (Voltage root mean squared), or dB (decibel)], the type of waveform
you will use [DC, sine, square, triangle, or ramp], and the oscilloscope channel you will use to take
the data [channel one or two].

Once you have selected your numeric and ring controllers, find yourself a graph to display your
signal. To find the waveform graph follow the instructions of Figure 9.

Modern >> Graph >> Waveform Graph


Figure 9. The steps to select the waveform graph from the Controls palette.

In order for the instrument drivers in LabView to work, they need a VISA (Virtual Instrument
Software Architecture) to connect to the physical instruments. A VISA functions as an interface
library for controlling and utilizing GPIB, VXI, RS-232 and other instrument protocols. Since we
have two physical instruments we will need two VISAs. Follow the instructions of Figure 10.
Once your VISAs are added, address each of your VISAs to an instrument. The VISA address for
the function generator and oscilloscope is on the equipment. The address used in the software for
this equipment is actually an extremely long address which ends in the address given on the
equipment plus the term INSTR (e.g.: MY44010181::INSTR). The software will recognize the
address associated with each tool. You will only need to use the pulldowns associated with the
function generator and the oscilloscope I/O on the Front Panel to select the correct address for
these tools. Make sure to enter these addresses or your VI will not run.

Modern >> I/O >> VISA Resource Name


Figure 10. The steps to select a VISA from the Controls palette.

The last set of items you will need on your control panel are the Error In 3D.ctl and Error
Out 3D.ctl connections. These blocks ensure that the timing between the instrument drivers is
coordinated so that each instrument will operate at the appropriate time. To learn how to find the
error controls, consult Figure 11.

2-6
Modern >> Array, Matrix & Cluster >> Error In 3D.ctl
a)

Modern >> Array, Matrix & Cluster >> Error Out 3D.ctl
b)
Figure 11. The steps necessary to select the error controls from the Controls palette.
Take note of the symbol name for the error in (a) and the error out (b) controls.
You now have all the controls necessary for building your VI and the driver blocks to configure
and run the instruments. Now it is time to wire together your virtual instrument with the aid of the
Context Help window. If the Context Help window is not showing, select Help from the
menu from the main toolbar in the Diagram window and then select Show Context Help or
press Ctrl-H.

5.3. WIRING THE VI


To wire the VI, switch back to the Diagram window or press Ctrl-E on your keyboard. All of the
parts you installed on your panel are now present in the diagram window. Proceed to wire them
together using the context help window. The context help will inform you of how to wire your
block diagram together as well as the important parameters of your controllers. For example, the
context help tells you to start the range of the ring counter that controls the waveform input of the
hp 33120a - Select Arbitrary Waveform.vi driver at one although the default setting is zero.
Rename each block as you connect them to denote their significance. As you do this in the
Diagram window, the names will appear on the control panel. In order to wire or name a block
you must select the correct icon from the Tools palette (Figure 12). After you are finished
wiring together your circuit you are ready to debug.

Figure 12. The Tools palette. The finger is used to press buttons, the pointer is used to
select areas, the letter is used to change to text, and the spool is used to wire your diagram.

5.4. DEBUGGING THE VI


There are a number of errors that LabView automatically detects for you, one of which is broken
wires in the Diagram window. If there is an error with your VI there will be a broken arrow
under the main tool bar (Figure 13). You may either click it or press Ctrl-R on your keyboard and
all the errors known to LabView will be displayed.

a.) b.)

2-7
Figure 13. The run icon under the main control toolbar (a) changes to a broken arrow (b)
when errors are detected in your VI.

Not all errors are detected by LabView, so you may have to revisit your diagram a number of times
searching for errors, even if your VI is executable. Remember to use the Context Help window
in your debug process to make sure you wired everything right. Do not be afraid to execute your
VI in order to find errors. This may require you to switch back and forth from the Diagram
window to the Panel window. Do not worry about fixing the errors, which are displayed on the
bottom right hand side of the panel window. Simply read them and then come back to them after
you have finished with the next section of the procedure. The following are a list of the most
common errors students make in this lab:

1. Not connecting the ring counters to the correct inputs of their instrument drivers.
The waveform input to the hp 33120a - Select Arbitrary Waveform.vi block
must be a ring counter so that you may name each signal sine, square, triangle, etc.
The Units input to the hp 33120a - Config waveform.vi" block should be a ring
counter since it controls the units of the function generators signal such as Vpp,
Vrms, and dB.
The channel input to the "HP54600A/610B Read Waveform.vi block must be a
ring counter so that you may give the channels names.
2. Not setting the proper range for controls.
In the previous lab experience, you learned the limits of your physical lab
equipment. For example the minimum frequency for the function generator is 100
Hz. If you try to enter a lower value, it will cause an error.
As mentioned earlier, the proper range for the ring counter of the hp 33120a -
Select Arbitrary Waveform.vi block starts at one.
3. Not modifying the data type of a controller to match the VI block.
The Units input to the hp 33120a - Config waveform.vi" block must be an
unsigned integer. Unsigned integers are denoted by a U followed by an 8, 16, or
32 denoting the bit size.
Once your VI is executable, it is time to enter some values and do a trial run of your VI.

5.5. PREPARING TO PUT YOUR VI TO THE TEST


You need to do the following three things:
Construct the VI to read the waveforms set in the Function Generator.
Obtain a square wave output on Channel 1 of the Oscilloscope with 100 KHz and 3 VRMS.
Obtain a Sine wave output on the Channel 2 of the Oscilloscope with 10 KHz and 2 Vpp.
Connect the function generator to the appropriate oscilloscope channel with the coaxial cable.
Turn on the function generator and the oscilloscope. Set the function generator to High Z output
impedance and press the output button to the function generator. Make sure to select the
Frequency, Amplitude, Duty Cycle (given in percent), and DC offset on the Front Panel. Then
select the Amplitude Unit, the Type of Waveform, and the Oscilloscope Channel with the ring
counters. Finally select the address for the Function Generator and the Oscilloscope. Press the
white arrow in the upper left of the Front Panel to execute the program. Adjust the scale of the
horizontal and vertical axis to better fit the output data if necessary.
For each set of configurations, you should either print the screen of your VI verifying that your VI
works for the given configuration, or if your VI does not work you must be prepared to explain
why the parameters given were not valid. To facilitate grading, you will be required to label all of
your controllers. In addition, the following strings need to be entered into your ring counters so
that the TA will know what controller configuration gave the screen shot that you are turning in.

2-8
Enter the following states into your three ring counters. Each ring counter will then input this data
into a specific VI.
1. Amplitude Units: Enter the strings Vpp (Voltage peak to peak), Vrms (Voltage root
mean squared), and dB (decibel) in the first ring counter. This ring counter should
input the amplitude unit into the Config Waveform VI. These strings must be entered
in the same location and order as within the VI. Enter these parameters in the order
above starting from state zero to do this.
2. Waveform: Insert DC, sine, square, triangle, and ramp strings at the corresponding
places of this ring counter. This ring counter should input the type of waveform into
the Select Arbitrary Waveform VI. These strings must be entered in the same location
and order as within the VI. Enter these parameters in the order above starting from
state zero to do this.
3. Oscilloscope: Label channels one and two. This ring counter should input the channel
into the Read Waveform VI. These strings must be entered in the same location and
order as within the VI. Enter these parameters in the order above starting from state
zero to do this.
After entering this data in your ring counters test your VI a number of times to help you debug it.
Save your VI and all printed screens to your floppy disk for use in your lab report.

6. LAB REPORT
Type a lab report with a cover sheet containing your name, class (including section number), date
the lab was performed on, and the date the report is due. Use the following outline to draft your lab
report.

Summary: type a summary of the key features and advantages of using the LabView.
LabView
o Insert the screen shot for each configuration.
o Write an explanation of your configuration
o If your VI did not work, explain why it did not execute for the given parameters.
Conclusions: type a summary of the things that you learned from this lab.

2-9

You might also like