Documente Academic
Documente Profesional
Documente Cultură
Overview
In this tutorial, learn how to find and launch LabVIEW software in your Windows program directory as well
as use the LabVIEW Getting Started window to create a new file or access an existing file and many useful
LabVIEW resources.
Simply click Start on your Windows toolbar and navigate to All Programs. From the program directory,
click National Instruments LabVIEW 8.5.1.
If you do not have a shortcut for National Instruments LabVIEW 8.5.1, navigate through the programs list
and find the National Instruments program directory. A menu appears that shows all National Instruments
software installed on your computer. Navigate to LabVIEW 8.5.1 and select the LabVIEW icon. This
launches LabVIEW and opens the Getting Started window.
When you launch LabVIEW, the LabVIEW splash screen opens. It may take a few moments for LabVIEW
to launch depending on your system configuration and the number of LabVIEW modules you have
installed.
The Getting Started Window
The Getting Started window is divided in half from left to right. On the left is the Files section and on the
right is the Resources section. In the Files section under New, you can create a blank virtual instrument
(VI), project, or module-specific project, or you can select the More folder to start from one of the may
LabVIEW templates. Under Open, see a list of recently opened LabVIEW files such as VIs and projects. In
the Resources section, find additional getting started tools ranging from online discussion forums to a
comprehensive library of example programs that are shipped with LabVIEW.
Note: If you do not want to see the Getting Started window every time you launch LabVIEW, you can
configure LabVIEW to open a new, blank VI on launch instead. Select Tools»Options.
In the Options dialog box, select Environment from the Category list and place a checkmark in Skip
Getting Started window on launch checkbox.
Click OK to save and apply your changes. The many other options in the Getting Started window vary
depending on which version of LabVIEW and which toolkits you have installed.
It is essential to know how to change the options and preferences for LabVIEW. The Getting Started
windows have many important resources on it that are very useful. Make sure that you are familiar with all
of the different resources that are available on the Getting Started window.
Tutorial 2: Front Panel
Overview
This tutorial explores the Front Panel and its relationship with the Block Diagram. Learn about the different
types of Front Panel objects as well as how to find them on the Controls palette and place them on the
Front Panel.
This video explores the Front Panel and its relationship with the Block Diagram. Learn about the different
types of Front Panel objects as well as how to find them on the Controls palette and place them on the
Front Panel.This video explores the Front Panel and its relationship with the Block Diagram. Learn about
the different types of Front Panel objects as well as how to find them on the Controls palette and place
them on the Front Panel.This video explores the Front Panel and its relationship with the Block Diagram.
Learn about the different types of Front Panel objects as well as how to find them on the Controls palette
and place them on the Front Panel.
The front panel window is the user interface for the VI. The front panel has controls and indicators, which
are the interactive input and output terminals, respectively, of the VI. Controls and indicators placed on the
front panel are automatically placed on the block diagram. Refer to the ―Block Diagram‖ tutorial for more
information on block diagram terminals.
After opening the Controls palette, use it to place controls and indicators on the front panel.
Note: Use the thumb tack to pin the Controls palette to the front panel and then select View»Change
Visible Categories.
In the Change Visible Categories dialog box, click Select All and then OK to make all available controls
and indicators visible on the front panel.
The figure above has two controls – Number of Measurements and Delay (sec) – and one indicator, a
waveform graph named Temperature Graph. The user can change the input value for the Number of
Measurements and Delay (sec) controls. The user can see the value generated by the VI on the
Temperature Graph indicator. The VI generates the values for the indicators based on the code created
on the block diagram. To learn more about the block diagram, see the ―Block Diagram‖ tutorial.
Every control and indicator has a data type associated with it. For example, the Delay (sec) horizontal slide
is a numeric data type. Double-click the Delay (sec) control to make LabVIEW jump to the terminal location
on the block diagram. Notice the color of the terminal. Orange terminals signify a data type called double
(DBL), which is a type of numeric data.
The most commonly used data types are numeric, Boolean value, and string. Learn more about data types
in the ―Data Types‖ tutorial.
Follow steps 1-3 to create a numeric control and change its value.
1. Right-click the front panel to open the Controls palette, and from the Numeric subpalette drag and
drop a Numeric Control onto the front panel.
2. Label the control Input by double-clicking on the label and typing the word ―Input.‖
3. Now change the value of the control by clicking the increment or decrement button. Alternatively, you
can double-click the number with either the Labeling tool or the Operating tool, enter a new number, and
press the <Enter> key.
Follow steps 1 and 2 to create a string control and then use the Properties dialog box to add a scroll bar.
Start with a blank VI.
1. From the String & Path subpalette, select a String Control and place it on the front panel.
2. Right-click the string indicator to open the shortcut menu and select Properties.
3. From the Properties dialog box, put a check in the Show vertical scroll bar checkbox and click OK.
4. The resulting string control has a scroll bar so the user can scroll up and down to view all of the text.
This allows the use of a small string control to display a large amount of text.
Click the Run button to run your VI. You do not need to compile your code; LabVIEW compiles it
automatically. You can run a VI if the Run button appears as a solid white arrow, shown at left.
The Run button appears broken when the VI you are creating or editing contains errors. If the
Run button still appears broken after you finish wiring the block diagram, the VI is broken and cannot run.
Click this button to display the Error List window, which lists all errors and warnings.
Click Run Continuously to run the VI until you abort or pause execution. You also can click the
button again to disable continuous running.
While the VI runs, the Abort Execution button appears. Click this button to stop the VI
immediately if there is no other way to stop the VI. If more than one running top-level VI uses the VI, the
button is dimmed.
Caution: The Abort Execution button stops the VI immediately before it finishes the current iteration.
Aborting a VI that uses external resources, such as external hardware, might leave the resources in an
unknown state by not resetting or releasing them properly. Design VIs with a stop button to avoid this
problem.
Click Pause to pause a running VI. When you click the Pause button, LabVIEW highlights on the
block diagram the location where you paused execution, and the Pause button appears red. Click the
Pause button again to continue running the VI.
Select the Text Settings pull-down menu to change the font settings for the
selected portions of your VI, including size, style, and color.
Click the Align Objects pull-down menu to align objects along axes, including vertical, edge, and
left.
Click the Distribute Objects pull-down menu to resize multiple front panel objects to the same
size.
Click the Resize Objects pull-down menu to resize multiple front panel objects to the same size.
Click the Reorder pull-down menu when your objects overlap each other and you want to define
which one is in front or back of another. Select one of the objects with the Positioning tool and then select
from Move Forward, Move Backward, Move To Front, and Move To Back.
Click the Show Context Help Window button to toggle the display of the context help window.
Enter Text appears to remind you that a new value is available to replace an old value. The
Enter Text button disappears when you click it, press the <Enter> key, or click the front panel or block
diagram workspace.
Tip: The <Enter> key on the numeric keypad ends a text entry, while the main <Enter> key adds a new
line. To modify this behavior, select Tools»Options, choose Environment from the Category list, and
place a checkmark in the End text entry with Enter key option.
It is important for a VI to have an intuitive and easy-to-read front panel. The front panel is essentially the
gateway for all user input and output of a VI. Therefore it is essential that the programmer has good grasp
of how to effectively program a front panel.
Tutorial 3: Block Diagram
Overview
In this introduction to the Block Diagram, we examine the concept of this tool as well as the Block
Diagram’s relationship with the Front Panel. We also explore how to open the Block Diagram, how to find
objects in the Functions palette and put them on the Block Diagram, and how to use different toolbar icons.
In addition, we learn how to build a simple block diagram to illustrate the important concepts of creating
graphical code in NI LabVIEW software.
The block diagram contains the graphical source code of a LabVIEW program. The concept of the block
diagram is to separate the graphical source code from the user interface in a logical and simple manner.
Front panel objects appear as terminals on the block diagram. Terminals on the block diagram reflect the
changes made to their corresponding front panel objects and vice versa.
The Search button opens a search dialog box that you can use to search for functions by
name.
Click the Search button to launch the functions search engine. It takes a few moments to launch.
You can use this tool to search for a function by name if you are having trouble finding it.
Once you see the function you want, double -click on it and LabVIEW jumps to the place on the Functions
palette where you can find that function.
Note: Complete the following steps to change the subpalettes visible on the Functions palette:
1. Use the thumb tack to pin the Functions palette to the block diagram.
2. Notice the View button appears when you pin the Functions palette to the block diagram.
3. Select View and, from the shortcut menu, select Change Visible Categories.
4. In the Change Visible Categories dialog box, you can select the Palettes that you use the most or
click Select All to include all Palettes.
To change the appearance of the block diagram, select Tools»Options from the menu bar. In the Options
dialog box, select the Block Diagram category. Here you can customize the appearance of your block
diagram. To save space on the block diagram, deselect Place front panel terminals as icons.
Terminals
Terminals create the block diagram appearance of objects on the front panel. In addition, they are entry
and exit ports that exchange information between the front panel and block diagram. Analogous to
parameters and constants in text-based programming languages, terminals come in two types: control or
indicator terminals and node terminals. Control and indicator terminals belong to front panel controls and
indicators.
In the example above, data you enter in front panel controls a and b enter the block diagram through their
respective control terminals a and b. The data then enter the Add and Subtract functions. When the Add
and Subtract functions complete their calculations, they produce new data values. The data values flow to
the indicator terminals, where they update the front panel indicators a+b and a-b.
You can create controls and indicators from either the block diagram or the front panel. This tutorial
demonstrates this in a later section.
There are many different types of functions. Remember that a function has a pale yellow background like
the functions shown below.
SubVIs
SubVIs are VIs that you create to use inside another VI or that you access on the Functions palette. Any
VI has the potential to be used as a subVI. When you double-click a subVI that is on the block diagram, its
front panel window appears and you can access its block diagram. Some examples of the subVIs you can
find in the Functions palette are shown below.
Structures
Structures, which include for loops, case structures, and while loops, are used for process control. They are
examined in a later tutorial. You can open the Structures subpalette from the Functions palette under
Programming.
Below are some examples of different structures and how they look on the block diagram.
Now create the block diagram shown below by following these steps:
1. Open a blank VI from the toolbar. Select File»New VI.
2. Put two multiply functions on the block diagram by dragging them onto the block diagram from the
Numeric subpalette under Programming. Repeat to put a second multiply function on the block diagram.
Tip: To copy an object on the block diagram, hold down <ctr> while you click and drag the object.
3. Hover your mouse over the left-most multiply function to make the input and output terminals appear.
If you hold your mouse over one of the terminals, the wire spool appears along with the name of the
terminal you are hovering over.
To create a control for the y terminal, simply hover your mouse over it and right-click.
Do the same for the x terminal on the left-most multiply function so that you have a control for each input
terminal.
4. Wire the output terminal of the left multiply function to the x input of the right multiply function by
hovering your mouse over the output terminal. When it turns into the wiring spool, click and hold while you
drag the wire to the desired input.
5. Create the Triangular Multiplier constant .5 by right-clicking on the y input terminal of the right-most
multiply function and selecting Create»Constant. You can change the value of a constant by double-
clicking it to highlight the text and typing in the new value. Type in .5 and press <enter>.
6. Now right-click the output of the right multiply function and select Create»Indicator to create an
indicator that passes the value of the block diagram logic to the front panel.
Tip: You can make comments on the block diagram or the front panel by double-clicking the block diagram
and typing your comment into the automatically created text box.
You can change the name of indicators, controls, and constants by double-clicking the label and typing in
the desired name. If there is no label showing, right-click the desired object and select Visible
Items»Label.
7. Now look at the front panel that was generated from your work on the block diagram by pressing
<ctr-E> or selecting Window»Show Front Panel. Notice that the two controls Base(cm) and Height(cm)
and the indicator Area(cm^2) were automatically generated and placed on the front panel. You will run this
program after learning about the toolbar icons.
Click the Run button to run your VI. You do not need to compile your code; LabVIEW compiles it
automatically. You can run a VI if the Run button appears as a solid white arrow, shown at left.
The Run button appears broken when the VI you are creating or editing contains errors. If the
Run button still appears broken after you finish wiring the block diagram, the VI is broken and cannot run.
Click this button to display the Error List window, which lists all errors and warnings.
Click Run Continuously to run the VI until you abort or pause execution. You also can click the
button again to disable continuous running.
While the VI runs, the Abort Execution button appears. Click this button to stop the VI
immediately if there is no other way to stop the VI. If more than one running top-level VI uses the VI, the
button is dimmed.
Caution: The Abort Execution button stops the VI immediately before it finishes the current iteration.
Aborting a VI that uses external resources, such as external hardware, might leave the resources in an
unknown state by not resetting or releasing them properly. Design VIs with a stop button to avoid this
problem.
Click Pause to pause a running VI. When you click the Pause button, LabVIEW highlights on the
block diagram the location where you paused execution, and the Pause button appears red. Click the
Pause button again to continue running the VI.
Select the Text Settings pull-down menu to change the font settings for the
selected portions of your VI, including size, style, and color.
Click the Align Objects pull-down menu to align objects along axes, including vertical, edge, and
left.
Click the Distribute Objects pull-down menu to resize multiple front panel objects to the same
size.
Click the Reorder pull-down menu when your objects overlap each other and you want to define
which one is in front or back of another. Select one of the objects with the Positioning tool and then select
from Move Forward, Move Backward, Move To Front, and Move To Back.
Click the Show Context Help Window button to toggle the display of the context help window.
Enter Text appears to remind you that a new value is available to replace an old value. The
Enter Text button disappears when you click it, press the <Enter> key, or click the front panel or block
diagram workspace.
Values put into the controls on the front are passed to the block diagram, and the result that is computed by
the block diagram logic is passed back to the front panel indicator.
Click the Abort Execution button to stop the VI. Save and close the VI by selecting File»Save from the
menu bar and then clicking the Close button in the top right corner of the front panel window.
The block diagram is the most fundamental aspect of any virtual instrument. It controls everything from data
flow to passing data in and out of the front panel. It is essential for a LabVIEW programmer to have a clear
and solid understanding of how the block diagram works.
Tutorial 4: User Interface
Overview
This tutorial examines how to use NI LabVIEW tools to build user interfaces. Learn how to design controls
and indicators, use labels and captions, set default values for user interface objects, and apply color to
enhance the appearance of your user interface. Also get some basic tips and tools to help you create
elegant and functional user interfaces like the one below.
Concept
A user interface gives users a way to interact with the source code. It allows the user to change the values
passed to the source code and see the data that the source code computes. In LabVIEW, the user
interface is the front panel. It is important to identify the inputs and outputs of a software development
problem during the design phase of the development method. This identification leads directly to the design
of the front panel window.
You can acquire the inputs of the problem using the following methods:
1. Acquiring from a device such as a data acquisition device or multimeter
2. Reading directly from a file
3. Manipulating controls
You can display the outputs of the problem with indicators such as graphs, charts, or LEDs, or you can log
the outputs to a file. You can also output data to a device using signal generation.
Captions help you describe a front panel control. They do not appear on the block diagram. With captions,
you can document the user interface without cluttering the block diagram with additional text. Open a blank
VI and make a label and a caption for a thermometer indicator.
1. Put the thermometer indicator on the block diagram.
2. By default, only the label is visible. To change the label, double-click it and type in a new label that is
short but descriptive.
3. Right-click the thermometer indicator and select Properties.
In the Properties dialog box, put a check in the Visible checkbox under the Caption section of the
Appearance tab. Type Indoor Temperature in the Caption text box. Click OK to save the changes and
exit the dialog box. You can also change the label from the Properties dialog box.
4. Notice that the caption now appears on the front panel above the indicator. Switch to the block
diagram and note that only the label appears.
Control and Indicator Options
The front panel offers many options for controls and indicators that you can view by right-clicking on the
thermometer indicator and browsing through the shortcut menu and submenus. Complete the following
steps to create a temperature control and set the default value.
1. Put a numeric control on the front panel beneath the thermometer indicator. Make a caption for it that
says “Indoor Temperature Control.”
3. Right-click the control and select Data Operations»Make Current Value Default from the shortcut
menu.
4. Because you have a good caption for the temperature control, hide the label by right-clicking the
control and selecting Visible Items»Label from the shortcut menu. Do the same for the thermometer
indicator.
Using Color
The proper use of color can improve the appearance and functionality of your user interface. Using too
many colors, however, can result in color clashes that cause the user interface to look too busy and
distracting. LabVIEW provides a color picker that can help with determining the appropriate colors. Select
the Coloring tool from the tools palette and right-click an object or workspace to display the color picker.
With the color picker open, you can move your cursor to different colors and watch the objects or
workspace change as you move over different colors.
The top of the color picker contains a grayscale spectrum and a box you can use to create transparent
objects. The second spectrum contains muted colors that are well-suited for backgrounds and front panel
objects. The third spectrum contains colors that are well-suited for highlights. Moving your cursor vertically
from the background colors to the highlight colors helps you select appropriate highlight colors for a specific
background color.
Spacing and Alignment
White space and alignment are probably the most important techniques for grouping and separation; the
more items that your eye can find on a line, the cleaner and more cohesive the organization seems. When
items are on a line, the eye follows the line from left to right or top to bottom. This is related to the script
direction. Although some cultures view items right to left, almost all follow top to bottom. When you design
the front panel, consider how users interact logically with the VI and group controls and indicators. If
several controls are related, add a decorative border around them or put them in a cluster.
Centered items are less orderly than items aligned to the left or right. A band of white space on one side
acts as a very strong means of alignment. Centered items typically have ragged edges, and users cannot
determine the order as easily.
Placing front panel objects too close together can be problematic. Leave some blank space between
objects to make the front panel easier to read. Blank space also prevents users from accidentally clicking
the wrong control or button.
In general, use common sense and develop your own style of design for your user interfaces. Also refer to
these guidelines to help you successfully create user-friendly front panels. Notice the difference between
the following two simple user interfaces. Proper labeling, alignment, and spacing can make a big difference.
User Interface Tips and Tools
Some of the built-in LabVIEW tools for creating user-friendly front panel windows include tab controls and
decorations.
Tab Controls
Physical instruments usually have effective user interfaces. Borrow heavily from their design principles but
use smaller or more efficient controls, such as ring controls or tab controls, where appropriate. Use tab
controls to overlap front panel controls and indicators in a smaller area.
To add more pages to a tab control, right-click a tab and select Add Page Before or Add Page After from
the shortcut menu. Relabel the tabs with the Labeling tool and place front panel objects on the appropriate
pages. The terminals for these objects are available on the block diagram, as are terminals for any other
front panel object (except decorations). Complete the following steps to create a tab control with a
thermometer indicator, temperature control, fan speed control, and sector alarm for a building with three
sectors. Start with a new VI.
2. Add one round LED and label it Sector 1 Alarm, add one thermometer indicator and label it Sector
Temperature, and add one dial control and label it Fan Speed Control. Your front panel should look like
this. (This tutorial does not include examples featuring block diagrams.)