2. LV 2
•Graphical Programming
• Easy to use
• Faster Development Time
• Graphical User Interface
• Graphical Source Code
• Easily Modularized
• Application Builder to create
stand-alone executables
LabVIEW
TM
3. LV 3
Network-based
Measurement & Automation
Acquire
Anywhere
Analyze
Anywhere
Present
Anywhere
Your entire Measurement and Automation
system can be controlled with LabVIEW
locally, or over the Internet
Network Network
4. LV 4
Acquisition with LabVIEW
• LabVIEW can acquire data by using
one or more of the following devices:
• GPIB
• Serial
• Data Acquisition (DAQ)
• Remote Data Acquisition (RDA)
• PCI eXtensions for Instrumentation (PXI)
• Image Acquisition (IMAQ)
• Motion Control
• Real-Time (RT) Board
• PLC (through OPC Server)
LabVIEW is completely
compatible with
National Instruments
hardware, and also
works with a variety of
third party devices
Acquire
Anywhere
5. LV 5
Analyze
Anywhere
Analysis with LabVIEW
• LabVIEW includes the following
tools to help you analyze your data:
• Analysis VIs for Differential
Equations, Optimization, Curve
Fitting, Calculus, Linear Algebra,
Statistics, etc.
• Signal Processing VIs for Filtering,
Windowing, Transforms, Peak
Detection, Harmonic Analysis,
Spectrum Analysis, etc.
Analysis can either be
done directly in
LabVIEW, or with third
party software such as
Matlab, HiQ, or C
6. LV 6
Present
Anywhere
Presentation with LabVIEW
• LabVIEW includes the following
tools to help you present your data:
• On your machine - Graphs, Charts,
Tables, Gauges, Meters, Tanks, 3D
Controls, Picture Control, 3D
Graphs (Windows Only), Report
Generation (Windows Only)
• Over the Internet - Web Publishing
Tools, Datasocket (Windows Only),
TCP/IP, VI Server
• Enterprise Connectivity Toolset -
SQL Tools (Databases), Internet
Tools (FTP, E-mail, Telnet, HTML)
Presentation with
LabVIEW can be
done on your PC or
over a network, and
you can use third
party software like
Excel, or DIAdem
7. LV 7
Introduction to LabVIEW
You Will Learn:
A. What a virtual instrument (VI) is
B. The LabVIEW environment
C. LabVIEW Help Options
8. LV 8
Start » All Programs » National Instruments LabVIEW 8.0
Startup Screen:
Start from a Blank VI:
New»Blank VI
Start from an Example:
Examples»Find
Examples…
»
or
Open and Run LabVIEW
9. LV 9
Each VI has 2 Windows
Front Panel
• User Interface (UI)
– Controls = Inputs
– Indicators = Outputs
Block Diagram
• Graphical Code
– Data travels on wires from
controls through functions to
indicators
– Blocks execute by Dataflow
LabVIEW Programs Are Called Virtual Instruments (VIs)
10. LV 10
• Recommended: Automatic Selection Tool
• Tools to operate and modify both front panel and
block diagram objects
Operating Tool
Positioning/Resizing Tool
Labeling Tool
Wiring Tool
Tools Palette
Automatic Selection Tool
Automatically chooses among the following tools:
11. LV 11
Run Button
Continuous Run Button
Abort Execution
Execution Highlighting Button
Additional Buttons on
the Diagram Toolbar
Status Toolbar
Retain Wire Values Button
Step Function Buttons
12. LV 12
Creating, Editing, & Debugging a VI
A. How to Create VIs
B. How to Edit VIs
C. How to Debug VIs
You Will Learn:
13. LV 13
Creating a VI Front Panel
• Numeric controls and indicators
• Boolean controls and indicators
• Configuring controls and indicators
– Use shortcut menus
– Parts have different menus
Digital
Control
Digital
Indicator
Labels
Increment
Buttons Boolean
Control
Boolean
Indicator
14. LV 14
Accessing Shortcut Menus
Right-click on the label
for its shortcut menu Right-click on the digital
display for its shortcut menu
15. LV 15
Terminal pattern for the
Add Function and the
Subtract function (three
node terminals).
Creating a VI Block Diagram
NodesWires
Control
Terminals
Diagram Window
Panel Window
Indicator
Terminals
16. LV 16
Wiring a VI Block Diagram
Hot Spot
Tools to Help Wiring
- Automatic Wiring
- Tip Strips
- Right-click on terminals
and select Show Terminals
- Context Help Window
Scalar 1D Array
Numeric
Boolean
String
Orange (floating point)
Blue ( integer)
Green
Purple
2D Array
18. LV 18
Debugging Techniques
• Finding Errors
• Execution Highlighting
• Probe
Click on broken Run button
Window showing error appears
Click on Execution Highlighting button; data
flow is animated using bubbles. Values are
displayed on wires.
Right-click on wire to display probe and it
shows data as it flows through wire segment
You can also select Probe tool from Tools
palette and click on wire
19. LV 19
Debugging Techniques
• Breakpoints
• Step Into, Over, and Out buttons for Single
Stepping
Click on Step Into button to enable single stepping
Once Single Stepping has begun, the button steps
into nodes
Click on Step Over button to enable single stepping
or to step over nodes
Click on Step Out button to step out of nodes
Select Breakpoint tool from Tools palette and click
on wire or node where you want execution to pause
26. LV 26
The Connector Pane
• The terminal colors match the data types to
which they are connected
• Click on the terminal to see its associated
front panel object
27. LV 27
Exercise 2
Students build icon and connector for
Convert C to F.vi
*This VI will be used in a later exercise.
28. LV 28
Using the VI as a SubVI
• Changes made to subVI saved in memory until
saved to disk
• Calling subVIs
– Functions >>Select a VI…
OR
– Drag icon onto target diagram
29. LV 29
Help and Classifying Terminals
• Context Help for subVIs
• Classify inputs and outputs:
How displayed in Context Help Window
Required - Bold label
Recommended - Normal text
Optional - Visible or wire
stubs shown
30. LV 30
Documenting the VI
• Document VIs - VI Properties>>Documentation
• Document objects - Description and Tip...
VI Documentation
Description and Tip
32. LV 32
The Create SubVI Option
• Enclose area to be converted into a subVI
• Select Create SubVI from the Edit Menu
33. LV 33
Loops and Charts
A. About While Loops
B. About waveform charts
D. About For Loops
You Will Learn:
34. LV 34
While Loop
Do
(Execute diagram
inside Loop)
While Condition is TRUE
1. Select While Loop
2. Enclose code to be repeated
3. Drop or drag additional nodes and then wire
35. LV 35
Select the Loop Condition
• Right-click on Conditional Terminal to define
when the loop stops
Iteration Terminal Conditional Terminal
37. LV 37
Customizing Charts and Graphs
• Plot Legend (color, point style, line style, etc.)
• Digital Display
• Scrollbar
• Customize the
X and Y Axes
• Graph Palette
• Scale Legend
40. LV 40
For Loop
• In Structures subpalette of Functions palette
• Enclose code to be repeated and/or resize and
add nodes inside boundary
• Executes diagram inside of loop a predetermined
number of times
Count terminal
(Numerical input)
41. LV 41
Numeric Conversion
• Numeric defaults to double precision (8 bytes) or
long integer (4 bytes)
• LabVIEW automatically converts to different
representations
• Gray coercion dot on terminal indicates conversion
42. LV 42
Arrays, Graphs, and Clusters
A. About arrays
B. About generating arrays with loops
C. Some basic array functions
D. What polymorphism is
E. Using graphs to display data
You Will Learn:
43. LV 43
Arrays
• Collection of data elements that are of same type
• One or more dimensions, up to 2 elements per
dimension
• Elements accessed by their index
• First element is index 0
31
index
10-element array 1.2 3.2 8.2 8.0 4.8 5.1 6.0 1.0 2.5 1.7
0 1 2 3 4 5 6 7 8 9
2D array
Five-row by seven column
array of 35 elements
0 1 2 3 4 5 6
0
1
2
3
4
44. LV 44
Array Controls and Indicators
Add Dimension for 2D
arrays
1. Select the Array Shell
from the Controls palette
2. Place data object inside
shell
45. LV 45
Creating Array Constants
1. Select Array
Constant shell
from the Array
subpalette
2. Place the data object in
the array shell
46. LV 46
Creating and Using Arrays
• Auto-Indexing –
loops accumulate
arrays at their
boundaries
• For Loops auto
index by default;
While Loops do
not
47. LV 47
Creating 2D Arrays
• Inner loop creates column elements
• Outer loop stacks them into rows
49. LV 49
The Build Array Function
Building a higher dimension array
Concatenate Inputs (default)
Appending an element
50. LV 50
The Index Array Function
Extracting an Element
Extracting a Row
51. LV 51
Polymorphism
• Function inputs can be of different types
• All LabVIEW arithmetic functions are polymorphic
• Run Polymorphism
Example.vi
Scalar + Scalar
Array + Scalar
Combination Result
Scalar
Array
Array
1 4 2
2
4 6 7
5
2
7
Array + Array 3 2 5
1 4 2
Array + Array 1 4 2
3 2 5 7
Array3 6 4
4 6 7
52. LV 52
Graphs
• Selected from the Graph subpalette
• Waveform Graph – Plot an array of numbers
against their indices
• XY Graph – Plot one array against another
Plot Legend
(point and
line styles)
Graph Palette
Scale Legend
53. LV 53
Single-Plot Waveform Graphs
Uniform X axis - initial X = 0.0, delta X = 1.0
Uniform X axis - you specify point spacing
55. LV 55
Case and Sequence Structures
A. About Case structures
B. About Sequence structures
D. How to replace Sequence structures
You Will Learn:
56. LV 56
Case Structures
• In the Structures subpalette of Functions palette
• Enclose nodes or drag them inside the structure
• Stacked like a deck of cards, only one case visible
57. LV 57
Boolean and Numeric Cases
Note: all possible outputs of the Case structure must be wired
58. LV 58
Sequence Structures
• In the Structures subpalette of Functions palette
• Executes diagrams sequentially, Frame 0 (0..x),
where x is the total number of frames
• Stacked like a deck of cards, only one frame visible
59. LV 59
Sequence Locals
• Pass data from one frame to future frames
• Created at the border of the Sequence structure
Sequence local
created in
Frame 1
Data not
available
Data
available