You are on page 1of 9

Practical 8

Getting Started with LABVIEW

Objective:

1. Introduction to LABVIEW Environment and Features


2. Running a VI in LABVIEW
3. To create and run a Water Level Detector VI

Tools/Software Requirement

 A PC/Laptop with LABVIEW


Recommended Books:
 Measurement and Instrumentation, Theory and Application by Alan S. Morris and Reza
Langari.
 Measurement and Instrumentation Principles 3rd Edition by Alan S. Morris.
 The Essence of Measurement by Alan S. Morris.

Activity Time Boxing

Task No. Activity Name Activity Time


Lecture and overview by instructor
1 15 ~ 20 mins
2 Performing Experiment 120 ~140 mins
3 Results & Evaluation(signed by the instructor) 15 ~ 20 mins
Total Time: 180

Theory

LabVIEW, short for Laboratory Virtual Instrument Engineering Workbench, is a programming


environment in which one can create programs using some graphical notations (connecting
functional nodes via wires through which data flows). It differs from traditional programming
languages like C, C++, or Java, in which one programs with text. LABVIEW uses a uses a
graphical programming language often called G to create programs in a pictorial form called a
Block Diagram.
LabVIEW is much more than a programming language. It is an interactive program development
and execution system designed for people, like scientists and engineers, who need to program
as part of their jobs. Using the graphical programming language,it is specifically designed to
take measurements, analyze data, and present results to the user. It is also ideal for
simulations, presentation of ideas, general programming, or even teaching basic programming
concepts.

Virtual Instruments (VI):


A LabVIEW program consists of one or more virtual instruments (VIs). Virtual instruments are
called such because their appearance and operation often imitate actual physical instruments.
However, behind the scenes, they are analogous to main programs, functions, and subroutines
from popular programming languages like C or Basic ALabVIEW program is always called a VI,
whether its appearance or function relates to an actual instrument or not.
AVI has three main parts: a front panel, a block diagram, and an icon.
Front Panel:
The front panel is the interactive user interface of a VI, so named because it simulates the front
panel of a physical instrument (see Figure 8.1). The front panel can contain knobs, push
buttons, graphs, and many other controls (which are user inputs) and indicators (which are
program outputs). One can input data using a mouse and keyboard, and then view the results
produced by your program on the screen.

Figure 8.1 LabView VI Front Panel


The block diagram is the VI’s source code, constructed in LabVIEW’s graphical programming
language, G (see Figure 8.2). The block diagram is the actual executable program. The
components of a block diagram are lower-level VIs, built-in functions, constants, and program
execution control structures. You draw wires to connect the appropriate objects together to
define the flow of data between them. Front panel objects have corresponding terminals on the
block diagram so data can pass from the user to the program and back to the user.

Fig. 8.2 A VI Block Diagram

In order to use a VI as a subroutine in the block diagram of another VI, it must have an icon with
a connector (see Figure 8.3). AVI that is used within another VI is called a subVI and is
analogous to a subroutine. The icon is a VI’s pictorial representation and is used as an object in
the block diagram of another VI. A VI’s connector is the mechanism used to wire data into the VI
from other block diagrams when the VI is used as a subVI. Much like parameters of a
subroutine, the connector defines the inputs and outputs of the VI.

Fig 8.3 VI Icon (left) & Connector (right)


Procedure
Running a VI Program in LABVIEW
1. Launch the NI Example Finder by clicking on Help in taskbar and clicking on Find
Examples option.
2. With the Browse tab selected and the Browse according to: option set to Task, navigate
the folder tree to “Industry Applications,” and then Double click “Temperature
Monitoring .Ivproj” to open it.
3. A new dialog box will pop up named Temperature Monitoring.Ivproj. This window
includes all the sub Vis and libraries relevant to Temperature Monitoring.
4. Click on the Temperature Monitoring.vi. You will see the following or similar VI window of
Figure 8.4.

Figure 8.4 Temperature System Demo VI Front Panel

5. This particular VI demonstrates a temperature monitoring system built from the


continuous measurement and logging sample project.
RuntheVIbyclickingontheRunbutton,locatedontheVI’sToolbar(theToolbaristherow of
iconsbeneaththeVI’smenubar).The Run button will change appearance to indicate that
the VI is running. Other buttons on the Toolbar may also change appearance (or
disappear) because certain buttons are only applicable while the VI is running (such as
the Abort button), and others are only applicable while the VI is not running (such as
those used for editing). Click on the Start button to start the monitoring simulation
process.
6. Notice also that the Abort button becomes active in the Toolbar. You can press it to
abort program execution.
Temperature Monitoring.vi simulates a temperature monitoring
application.TheVImakestemperaturemeasurementsanddisplaysthem in temperature
indicator and on the chart.Although the readings are simulated in
thisexample,youcaneasilymodifythe programto measureallvalues.
7. To Tweak Values,Usethe high limit and low limit sliders to change the values of the high
and low limits. Highlight the old high or low value, either by clicking twice on the value
you want to change.
8. To change the marker spacing, right click on the graph scale and manipulate the values.
9. Stop the VI by clicking on the Acquisition switch.
10. Open the block diagram (Figure 8.4) of Temperature System Demo.vi by choosing Show
Diagram from the Windows menu—or you can use the <ctrl>-E shortcut on Windows,
<command>-E on Mac OS X, or <meta>-E on Linux.

Figure 8.5 Temperature Monitoring Block Diagram

11. Examine the different objects in the diagram window. Open the contextual Help window
by choosing Show Context Help from the Help menu—or you can use the <ctrl>-H
shortcut on Windows, <command>-H on Mac OS X, or <meta>-H on Linux.
12. Position the cursor over different objects in the block diagram and watch the Help
window change to show descriptions of the objects. If the object is a function or subVI,
the Help window will describe the inputs and outputs as well.
13. Turn on execution highlighting by clicking on the Highlight Execution button, so that the
light bulb changes to the active(lighted) state. With execution highlighting turned on, you
can watch the data flow through the wires. You will see small data bubbles that travel
along the wires, representing the data flowing through the wires.
14. Select Close from the File menu of Temperature System Demo.vi, and do not save any
changes. Note that, selecting Close from the File menu of a VI diagram closes the Block
Diagram window only. Selecting Close on a Front Panel window closes both the Panel
and the Diagram.

Creating a VI in LabView
1. Open Front Panel and right click to select Decoration from menu.
2. Select Flat Boxes from Decorations option. Increase one’s size in a vertical rectangular
shape and another in a square shape.
3. Right click and move to numeric icon and select Tank from Numeric mode. Rename it as
Water Tanker and adjust its size.
4. Now by right clicking the mouse in front panel, click on numeric option again and select
Vertical Graduated Bar from Numeric mode. Label it as Water Level.
5. Move and adjust the tanker’s size as well as graduated level indicator.
6. Now right click mouse in front panel to select two Boolean LEDs.
7. You might have observed how block diagram also insert your chosen items.
8. In Block Diagram, directly connect water tanker to Water Level.
9. Right click in Block diagram, click on Greater or Equal in comparison option and connect
one end of gate with Boolean LED and other with the wire between water level and
water tanker.
10. Right click and create constant as 2 for this logic gate.
11. Right Click in Block diagram and click on Less than or Equal in comparison option and
connect this logic gate with previous one.
12. Rename both Boolean as High Water Level and Low Water Level.
13. In Front Panel, right click on Water Level LEDs and go to properties and assign colors
green and red to the respective LEDs for their enabled state.

We can see how changing the volume in water tanker will affect the values in water
level.
Front Panel
Block Diagram

Observations
In the lab view task we observed the following
 The tank has a level that displays the water level as a vertical bar.
 Red is displayed as the high water level indicator.
 Green is another sign for low water levels.
 One tank has water in it.
 When the water level reaches a particular high position, the red indication begins to blink,
and when the water level reaches a certain low position, the green light begins to blink.

Analysis/Discussion
We conclude that Lab View is a programming environment in which one can create programs
using some graphical notations. It is much more than a programming language. It is an
interactive program development and execution system designed for people, like scientists and
engineers.

We analyze that this software has also practical importance in our daily life as well. In this task
we analyze the water level of tank that when tank is full then red light blinks and when tank is
empty green light blinks. We can use same phenomenon in our home by using a lab view
programmed circuit which can tell us when there is need to start water motor or not. It means
when our home tank level is low it will blink as green and when its high it will blinks red.
Evaluation Criteria:

Performance Exemplary Satisfactory Developing Unsatisfactory Marks


Criteria
(9-10) (6-8) (3-5) (0-2)

Procedure Steps of Steps of Steps of Procedure is


experiments are experiments are experiments are missing.
clear, sequential present but lacking incomplete and
Result and
and in complete completeness. procedure is
analysis is also
sentences. Picture lacking. Result
Result & Analysis not recorded.
of steps if needed and analysis is
are written in
are included. Result also lacking.
incomplete
& Analysis are
sentence.
written in a
complete form.

Exemplary Satisfactory Developing Unsatisfactory Marks

(5) (3-4) (1-2) (0)

Understandin Understands Understands Understands few Wasn’t able to


g the Concept everything of the majority of the things. explain
topic. portion. anything.

Lab Instructor: Lec.Basit Shafiq/L.E Wahaj Rafique

You might also like