EE201 Labview
EE201 Labview
Objective: To learn the LABVIEW Basics and get familiar with LABVIEW commands.
Overview of LABVIEW
The Front Panel is the user interface of the VI, to interact with the user when the program is running.
Users can control the program, change inputs, and see data updated in real time. You build the front panel
with controls and indicators (available on the Control Palette), which are the interactive input and
output terminals of the VI, respectively. Controls are knobs, pushbuttons, dials, and other input
devices.
Indicators are graphs, LEDs, and other displays.
Controls simulate instrument input devices and supply values to the block diagram of the VI.
Indicators simulate instrument output devices and display values the block diagram acquires or ge
nerates. These may include data, program states, and other information. Every front panel control
or indicator has a corresponding terminal on the block diagram. When a VI is run, values from c
ontrols flow through the block diagram, where they are used in the functions on the diagram, and the re
sults are passed into other
functions or indicators. The Controls palette is available only on the front panel. Go to Window»
Show Controls Palette or right‐click the front panel workspace to display the Controls palette.
The Block Diagram contains this graphical source
code. Front panel objects appear as terminals on the block diagram. Additionally, the block diagram
contains functions and structures from built‐in
LabVIEW VI libraries. These can be accessed from the Functions Palette. Wires connect each of
the nodes on the block diagram, including control and
indicator terminals, functions, and structures.
The Functions palette is available only on the block diagram. Select Window»Show Functions Palette o
r right‐click the block diagram workspace to display the Functions palette The Icon/Connector may
represent the VI as a subVI in block diagrams of calling VIs. Controls and indicators on the front
panel allow an operator to input data into or extract data from a running virtual instrument. However, the
front panel can also serve as a programmatic interface. Thus a virtual instrument can either be r
un as a program, with the front panel serving as a user interface, or, when droppedas a node onto t
he block diagram, the front panel defines the inputs and outputs for the given node through the connector
pane. This implies each VI can be easily tested before being embedded as a subroutine into a larger progr
am.
The graphical approach also allows non‐programmers to build programs by simply dragging and d
ropping virtual representations of the lab equipment with which they are already familiar. The La
bVIEW programming environment, with the included examples and the documentation, makes it easy to
create small applications. For complex algorithms or large‐scale code it is important that the progr
ammer possess an extensive knowledge of the special LabVIEW syntax and the topology of its
memory management. The most advanced LabVIEW development systems offer the possibility of
building stand alone application. The other
features that you will need include the Tools Palette which is a Floating Palette that is used to o
perate and modify front panel and block diagram objects and the Status Toolbar. They contain th
e following tools and buttons respectively.
Exercise 1 - Open and Run a Virtual Instrument
Examine the signal feneration processing VI and run it. Change the frequency and types of the
input signals and notice how the display on the graph changes. Change the signal processing
window and filter options. After you have changed the VI and other options, you can change ,
stop the VI processing by pressing stop button .
1. Select Start»Programs»National Instruments»LabVIEW 7.0»LabVIEW to launch Lab
VIEW.
The LabVIEW dialog box appears.
2. Select Help»Find Examples. The dialog box that appears lists and links to all availabl
e
LabVIEW example VIs.
3. On the Browse Tab, select browse according to task. Choose Analyzing and Processin
g
Signals, then Signal Processing, then Signal Generation and Processing.vi.
This will open the Signal Generation and Processing VI Front Panel.
Objective: To learn the LABVIEW Basics and get familiar with LABVIEW commands.
Building a VI
Beforebuilding our own VI we will first examine the Signal Generation and Processing VI and
run it. Change the frequencies and types of the input signals and notice how the display on the g
raph changes.
Change the Signal Processing Window and Filter options. After you have examined the
VI and the different options you can change, stop the VI by pressing the Stop button.
Block Diagram
This block diagram contains several of the basic block diagram elements, including sub
VIs, functions, and structures, which you will learn about later in this course.
9. Select Window»Show Panel or press the <Ctrl‐E> keys to return to the Front Panel.
EE 461
Introduction to Instrumentation and Control lab
Experiment 2
Date of Experiment :
Experiment No: 2. Building a VI & Modifying a Signal
Use a while loop and a waveform chart to build a VI that demonstrates software timing.
Front Panel
1. Open a new VI.
2. Build the following front panel.
12.
Right‐click the waveform chart and select Data Operations»Clear Chart from the shortcut
menu to clear the display buffer and reset the waveform chart. If the VI is running, you
can select Clear Chart from the shortcut menu.
Adding Timing
When this VI runs, the While Loop executes as quickly as possible. Complete the following step
s to take data at certain intervals, such as once every half‐second, as shown in the following bloc
k diagram .
a. Place the Time Delay Express VI located on the Functions»Execution Control palette. In
the dialog box that appears, insert 0.5. This function would make sure that each iteration
occers every half-second(500ms).
b. Divide the millisecond delay by 1000 to get time in seconds. Connect the output of the
divide function to the Delay Time (s) input of the Time Delay Express VI. This will allo
w
you to adjust the speed of the execution from the pointer slide on the front panel.
13. Save the VI, because you will use this VI later in the course.
14. Run the VI.
15. Try different values for the millisecond delay and run the VI again. Notice how this
effects the speed of the number generation and display.
1. Modifying a Signal
Displaying Two Signals on a Graph
EE 461
Introduction to Instrumentation and Control lab
Experiment 3
Date of Experiment :
Experiment No. 3: Exercises in Lab VIEW
Front Panel
1. Open a new VI and build the following front panel using the following tips.
a. Create a waveform graph indicator from the Controls»Graph Indicators palette. Use the
position/size/select tool to move the plot legend to the side, and expand it to display two
plots. Use the labeling tool to change the plot names and the properties page to choose
different colours for your plots.
b. Place a Stop button on the front panel.
c. Place two vertical pointer slides from the Controls»Numeric Controls palette. Use the
properties page again to change the slide fill colour.
Block Diagram
Front Panel
1. Open a new VI and build the following front panel using the following tips.
a. Create a numeric control and change the Label to Square Root Input. Create a numeric indicator
for Square Root.
b. Place Error In 3D.ctl from Controls»All Controls»Arrays & Clusters.
c. Place Error Out 3D.ctl from Controls» All Controls»Arrays & Clusters.
Block Diagram
End of Exercise
Exercise 3- Simple State Machine
Create a VI using state machine architecture that simulates a simple test sequence. The VI will have an initial state,
where it will display a pop‐up message indicating that it is starting the test. Then it will proceed to the next case
and then to the final state where it will ask the user whether to start over or end the test.
Front Panel
Rather than start from scratch, we will use a VI template to create our state machine.
1. From the initial LabVIEW screen click on New…, and choose Standard State Machine, which is located
under the VI from Template » Frameworks » Design Patterns heading.
2. Examine the template, and then save it in another directory before you begin working on it.
Block Diagram
3. Right click on the enum constant labeled Next State and select Open Type Def.
4. On the front panel of the StateMachinesStates.ctl Type Def VI, right click on the States enum control and
choose Edit Items.
5. Add two more states. Call them “State 1” and “State 2”
6. Close the State Machines.ctl Type Def Front panel and save the control with the default name when
prompted.
7. Right click on the Case Selector Label of the case structure and choose Duplicate case. Do this one
additional time so that there are four cases: Initialize, State 1, State 2, and Stop.
9. Right click on the shift register on the left side of the while loop and create an indicator. Change it’s
name to “Current State”.
10. In the “Initialize”, Default case place a One Button Dialog function and wire a string constant into the
Message input. Type “Now beginning test…” into the string constant.
11. Change the enum constant labled Next State to “State 1”.
12. Change to the next state in the case structure (“State 1”) and change the enum constant labled Next
State to “State 2”.
13. Change to the next state (“State2”) and add the following code.
a. Place a Select function and connect two enum constants
(Tip: Copy the enum constants from one of the previous cases)
b. Place a Two Button Dialog and wire create the constants as illustrated below.
End of Exercise
Exercise: Traffic Light
Construct a VI that will display a traffic light in the Front Panel. See figure below. Light transitions are
timed. Let red take 2s, yellow 1s and green 3s. Try to utilize your knowledge of LabVIEW in constructing
this VI.
Exercise: Filling and emptying a Tank
Build a VI that display a Front Panel similar to which shown below. The front panel should have a
Numeric Control to set a desired tank level. The filling and emptying tasks should be displayed gradually.
Your VI should decide by itself if it is to fill or to empty the tank. An OK button is to start the task.