Experiment No.1: Components of Labview: Objective
Experiment No.1: Components of Labview: Objective
1: Components of LabVIEW
Objective: To open, and expore t!e components of LabVie".
T!eor#
LabVIEW is a graphical programming language that uses icons instead of lines of
text to create applications. In contrast to text-based programming languages,
where instructions determine program execution, LabVIEW uses data flow
programming, where data determine execution. In LabVIEW, you build a user
interface by using a set of tools and objects. he user interface is !nown as the
front panel. "ou then add code using graphical representations of functions to
control the front panel objects. he bloc! diagram contains this code. If organi#ed
properly, the bloc! diagram resembles a flowchart. "ou can purchase se$eral
add-on software toolsets for de$eloping speciali#ed applications. %ll the toolsets
integrate seamlessly in LabVIEW.
.
LabVIEW is integrated fully for communication with hardware such as &'I(, V)I,
')I, *+-,-,, *+-./0, and plug-in data ac1uisition de$ices. LabVIEW also has
built-in features for connecting your application to the Internet using the LabVIEW
web ser$er and software standards such as2'3I' networ!ing and %cti$e).
4sing LabVIEW, you can create -,-bit compiled applications that gi$e you the
fast execution speeds needed for custom data ac1uisition, test, measurement,
and control solutions. "ou also can create stand-alone executables and shared
libraries, li!e 5LLs, because LabVIEW is a true -,-bit compiler.
LabVIEW contains comprehensi$e libraries for data collection, analysis,
presentation, and storage. LabVIEW also includes traditional program
de$elopment tools. "ou can set brea!points, and single-step through the program
to ma!e debugging and de$elopment easier. LabVIEW also pro$ides numerous
mechanisms for connecting to external code or software through 5LLs, shared
libraries, %cti$e), and more. In addition, numerous add-on tools are a$ailable for
a $ariety of application needs.
Virt$a Instr$ments
LabVIEW programs are called $irtual instruments 6VIs7. VIs contain three main
components8the front panel, the bloc! diagram, and the icon and connector
pane. he front panel is the user interface of the VI. he following example
shows a front panel.
1
"ou build the front panel with controls and indicators, which are the interacti$e
input and output terminals of the VI, respecti$ely. 2ontrols are !nobs, push
buttons, dials, and other input de$ices. Indicators are graphs, LE5s, and other
displays. 2ontrols simulate instrument input de$ices and supply data to the bloc!
diagram of the VI. Indicators simulate instrument output de$ices and display data
the bloc! diagram ac1uires or generates.
%fter you build the front panel, you add code using graphical representations of
functions to control the front panel objects. he bloc! diagram contains this
graphical source code. 9ront panel objects appear as terminals, shown at left, on
the bloc! diagram. "ou cannot delete a terminal from the bloc! diagram. he
terminal disappears only after you delete its corresponding object on the front
panel. (loc! diagram objects include terminals, subVIs, functions, constants,
structures, and wires, which transfer data among other bloc! diagram objects.
he following example shows a bloc! diagram and its corresponding front panel.
2
%fter you build a front panel and bloc! diagram, build the icon and the connector
pane so you can use it in another VI. %VI within another VI is called a subVI. %
subVI corresponds to a subroutine in text-based programming languages. E$ery
VI displays an icon, shown at left, in the upper right corner of the front panel and
bloc! diagram windows. %n icon is a graphical representation of a VI. It can
contain text, images, or a combination of both. If you use a VI as a subVI, the
icon identifies the subVI on the bloc! diagram of the VI.
"ou also need to build a connector pane, shown at left, to use the VI as a subVI.
he connector pane is a set of terminals that corresponds to the controls and
indicators of that
VI, similar to the parameter list of a function call in text-based programming
languages. he connector pane defines the inputs and outputs you can wire to
the VI so you can use it as a subVI. % connector pane recei$es data at its input
terminals and passes the data to the bloc! diagram code through the front panel
controls and recei$es the results at its output terminals from the front panel
indicators.
he power of LabVIEW lies in the hierarchical nature of the VI. %fter you create a
VI, you can use it as a subVI on the bloc! diagram of a high-le$el VI. here is no
limit on the number of layers in the hierarchy. 4sing subVIs helps you manage
changes and debug the bloc! diagram
1uic!ly.
3
%roced$re
LabVIEW Environment
When you launch LabVIEW, the following dialog box appears.
he LabVIEW dialog box includes the following components:
2lic! the Ne" VI button to create a new VI. 2lic! the arrow next to the button
to create another type of LabVIEW object, such as a control.
2lic! the Open VI button to open an existing VI. 2lic! the arrow next to the
button to open recently opened files.
2lic! the &'( )o$tions button to launch the 5%; +olution Wi#ard, which
helps you find solutions for common 5%; applications.
2lic! the )earc! Exampes button to open a help file that lists and lin!s to all
a$ailable LabVIEW example VIs.
2lic! the LabVIEW T$toria button to open the interacti$e LabVIEW Tutorial.
4se this tutorial to learn basic LabVIEW concepts.
4
*ront %ane Toobar
4se the toolbar buttons to run and edit a VI. he following toolbar appears on the
front panel.
2lic! the +$n button to run the VI. While the VI runs, the button changes to the
following if the VI is a high-le$el VI.
he +$n button often appears bro!en, shown at left, when you create or edit a
VI. his button indicates that the VI is bro!en and cannot run. 2lic! this button to
display the Error ist window, which lists all errors.
2lic! the +$n Contin$o$s# button to run the VI until you abort or pause it. "ou
also can clic! the button again to disable continuous running.
While the VI runs, the 'bort Exec$tion button appears. 2lic! this button to stop
the VI immediately.
5
,oc- &ia.ram Toobar
When you run a VI, buttons appear on the bloc! diagram toolbar that you can
use to debug the VI. he following toolbar appears on the bloc! diagram.
2lic! the /i.!i.!t Exec$tion button to see the flow of data through the bloc!
diagram. 2lic! the button again to disable execution highlighting.
2lic! the )tep Into button to single-step into a loop, subVI, and so on. +ingle-
stepping through a VI steps through the VI node to node. Each node blin!s to
denote when it is ready to execute. (y stepping into the node, you are ready to
single-step inside the node.
2lic! the )tep Over button to step o$er a loop, subVI, and so on. (y stepping
o$er the node, you execute the node without single-stepping through the node.
2lic! the )tep O$t button to step out of a loop, subVI, and so on. (y stepping out
of a node, you complete single-stepping through the node and go to the next
node.
he Warnin. button appears when there is a potential problem with the bloc!
diagram, but it does not stop the VI from running. "ou can enable the Warnin.
6
button by selecting Toos0Options and selecting &eb$..in. from the top pull-
down menu.
1en$s
he menus at the top of a VI window contain items common to other
applications, such as Open, )ave, Cop#, and %aste, and other items specific to
LabVIEW. +ome menu items also list shortcut !ey combinations. +ome menu
items are una$ailable while a VI is running.
4se the *ie menu primarily to open, close, sa$e, and print VIs.
4se the Edit menu to search for and modify components of a VI.
4se the Operate menu to run, abort, and change other execution options for the
VI.
4se the Toos menu to communicate with instruments and 5%; de$ices,
compare VIs, build applications, enable the Web +er$er, and configure LabVIEW.
4se the ,ro"se menu to na$igate through the VI and its hierarchy.
4se the Windo" menu to display LabVIEW windows and palettes.
4se the /ep menu to $iew information about palettes, menus, tools, VIs, and
functions, to $iew step-by-step instructions for using LabVIEW features, to
access the LabVIEW manuals, and to $iew the LabVIEW $ersion number and
information about computer memory.
%aettes
LabVIEW has graphical, floating palettes to help you create and run VIs. he
three palettes include the Toos, Contros, and *$nctions palettes. "ou can
place these palettes anywhere on the screen.
Toos %aette
"ou can create, modify, and debug VIs using the tools located on the floating
Toos palette. he Toos palette is a$ailable on the front panel and the bloc!
diagram. % tool is a special operating mode of the mouse cursor. When you
select a tool, the cursor icon changes to the tool icon. 4se the tools to operate
and modify front panel and bloc! diagram objects.
7
+elect Windo"0)!o" Toos %aette to display the Toos palette. "ou can place
the Toos palette anywhere on the screen. 'ress the <+hift= !ey and right-clic!
to display a temporary $ersion of the Toos palette at the location of the cursor.
4se the >perating tool to change the $alues of a control or select the text
within a control. he >perating tool changes to the following icon when it
mo$es o$er a text control, such as a digital or string control.
4se the 'ositioning tool to select, mo$e, or resi#e objects. he 'ositioning
tool changes to one of the following icons when it mo$es o$er a corner of a
resi#able object.
4se the Labeling tool to edit text and create free labels. he Labeling tool
changes to the following icon when you create free labels.
4se the Wiring tool to wire objects together on the bloc! diagram.
8
4se the >bject +hortcut ?enu tool to access an object shortcut menu with the
left mouse button.
4se the +crolling tool to scroll through windows without using scrollbars.
4se the (rea!point tool to set brea!points on VIs, functions, nodes, wires,
and structures to pause execution at that location.
4se the 'robe tool to create probes on wires on the bloc! diagram. 4se the
'robe tool to chec! intermediate $alues in a VI that produces 1uestionable or
unexpected results.
4se the 2olor 2opy tool to copy colors for pasting with the 2oloring tool.
9
4se the 2oloring tool to color an object. It also displays the current
foreground and bac!ground color settings.
Contros and *$nctions %aettes
he Contros and *$nctions contain subpalettes of objects you can use to
create a VI. When you clic! a subpalette icon, the entire palette changes to the
subpalette you selected. o use an object on the palettes, clic! the object and
place it on the front panel or bloc! diagram.
4se the na$igation buttons on the Contros and *$nctions palettes to na$igate
and search for controls, VIs, and functions. "ou also can right-clic! a VI icon on
the palette and select Open VI from the shortcut menu to open the VI.
Contros %aette
4se the Contros palette to place controls and indicators on the front panel. he
Contros palette is a$ailable only on the front panel. +elect Windo"0)!o"
Contros %aette or right-clic! the front panel wor!space to display the Contros
palette. "ou also can display the Contros palette by right-clic!ing an open area
on the front panel. ac! down the Contros palette by clic!ing the pushpin on the
top left corner of the palette.
10
*$nctions %aette
4se the *$nctions palette to build the bloc! diagram. he *$nctions palette is
a$ailable only on the bloc! diagram. +elect Windo"0)!o" *$nctions %aette
or right-clic! the bloc! diagramwor!space to display the *$nctions palette."ou
also can display the *$nctions palette by right-clic!ing an open area on the
bloc! diagram. ac! down the *$nctions palette by clic!ing the pushpin on the
top left corner of the palette.
)avin. VIs
+elect )ave, )ave 's, )ave ', or )ave "it! Options from the *ie menu to
sa$e VIs as indi$idual files or group se$eral VIs together and sa$e them in a VI
library. VI library files end with the extension .llb. @ational Instruments
recommends that you sa$e VIs as indi$idual files, organi#ed in directories,
especially if multiple de$elopers are wor!ing on the same project. LabVIEW uses
nati$e file dialogs for loading and sa$ing. "ou can disable this feature by
selecting Toos0Options and selecting 1isceaneo$s from the top pull-down
menu.
11
($estions:
1. Write t!e main components of Virt$a instr$ments.
2. W!at is t!e main roe of front pane and boc- dia.ram3
4. Write t!e name of t!e !ard"ares to "!ic! LabVIEW can comm$nicate.
12