LV 1
Introduction to LabVIEW
LV 2
•Graphical Programming
• Easy to use
• Faster Development Time
• Graphical User Interface
• Graphical Source Code
• E...
LV 3
Network-based
Measurement & Automation
Acquire
Anywhere
Analyze
Anywhere
Present
Anywhere
Your entire Measurement and...
LV 4
Acquisition with LabVIEW
• LabVIEW can acquire data by using
one or more of the following devices:
• GPIB
• Serial
• ...
LV 5
Analyze
Anywhere
Analysis with LabVIEW
• LabVIEW includes the following
tools to help you analyze your data:
• Analys...
LV 6
Present
Anywhere
Presentation with LabVIEW
• LabVIEW includes the following
tools to help you present your data:
• On...
LV 7
Introduction to LabVIEW
You Will Learn:
A. What a virtual instrument (VI) is
B. The LabVIEW environment
C. LabVIEW He...
LV 8
Start » All Programs » National Instruments LabVIEW 8.0
Startup Screen:
Start from a Blank VI:
New»Blank VI
Start fro...
LV 9
Each VI has 2 Windows
Front Panel
• User Interface (UI)
– Controls = Inputs
– Indicators = Outputs
Block Diagram
• Gr...
LV 10
• Recommended: Automatic Selection Tool
• Tools to operate and modify both front panel and
block diagram objects
Ope...
LV 11
Run Button
Continuous Run Button
Abort Execution
Execution Highlighting Button
Additional Buttons on
the Diagram Too...
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:
LV 13
Creating a VI Front Panel
• Numeric controls and indicators
• Boolean controls and indicators
• Configuring controls...
LV 14
Accessing Shortcut Menus
Right-click on the label
for its shortcut menu Right-click on the digital
display for its s...
LV 15
Terminal pattern for the
Add Function and the
Subtract function (three
node terminals).
Creating a VI Block Diagram
...
LV 16
Wiring a VI Block Diagram
Hot Spot
Tools to Help Wiring
- Automatic Wiring
- Tip Strips
- Right-click on terminals
a...
LV 17
Exercise 1
Students build Convert C to F.vi
* This VI will be used in a later exercise
LV 18
Debugging Techniques
• Finding Errors
• Execution Highlighting
• Probe
Click on broken Run button
Window showing err...
LV 19
Debugging Techniques
• Breakpoints
• Step Into, Over, and Out buttons for Single
Stepping
Click on Step Into button ...
LV 20
Exercise
Students modify and run Debug Exercise (Main).vi
(Uses Debug Exercise (Sub).vi)
LV 21
Creating a SubVI
A. What a SubVI is
B. How to create the icon and connector
C. How to use a VI as a subVI
You Will L...
LV 22
SubVI Example – Calculating Slope
LV 23
Creating the Icon
• Right-click in the icon pane (Panel or Diagram)
and select “Edit Icon…” option
LV 24
Creating the Connector
Right-click in the icon pane (Panel only)
LV 25
Creating the Connector - cont.
Click
LV 26
The Connector Pane
• The terminal colors match the data types to
which they are connected
• Click on the terminal to...
LV 27
Exercise 2
Students build icon and connector for
Convert C to F.vi
*This VI will be used in a later exercise.
LV 28
Using the VI as a SubVI
• Changes made to subVI saved in memory until
saved to disk
• Calling subVIs
– Functions >>S...
LV 29
Help and Classifying Terminals
• Context Help for subVIs
• Classify inputs and outputs:
How displayed in Context Hel...
LV 30
Documenting the VI
• Document VIs - VI Properties>>Documentation
• Document objects - Description and Tip...
VI Docu...
LV 31
Exercise 3
Students build Thermometer.vi
*This VI will be used in a later exercise.
LV 32
The Create SubVI Option
• Enclose area to be converted into a subVI
• Select Create SubVI from the Edit Menu
LV 33
Loops and Charts
A. About While Loops
B. About waveform charts
D. About For Loops
You Will Learn:
LV 34
While Loop
Do
(Execute diagram
inside Loop)
While Condition is TRUE
1. Select While Loop
2. Enclose code to be repea...
LV 35
Select the Loop Condition
• Right-click on Conditional Terminal to define
when the loop stops
Iteration Terminal Con...
LV 36
Waveform Charts
• Selected from the Controls >> Graph subpalette
LV 37
Customizing Charts and Graphs
• Plot Legend (color, point style, line style, etc.)
• Digital Display
• Scrollbar
• C...
LV 38
Wiring to Charts
• Single-Plot Chart
• Multiple-Plot Chart
LV 39
Exercise 4
Students build Temperature Monitor.vi
*This VI will be used in a later exercise.
LV 40
For Loop
• In Structures subpalette of Functions palette
• Enclose code to be repeated and/or resize and
add nodes i...
LV 41
Numeric Conversion
• Numeric defaults to double precision (8 bytes) or
long integer (4 bytes)
• LabVIEW automaticall...
LV 42
Arrays, Graphs, and Clusters
A. About arrays
B. About generating arrays with loops
C. Some basic array functions
D. ...
LV 43
Arrays
• Collection of data elements that are of same type
• One or more dimensions, up to 2 elements per
dimension
...
LV 44
Array Controls and Indicators
Add Dimension for 2D
arrays
1. Select the Array Shell
from the Controls palette
2. Pla...
LV 45
Creating Array Constants
1. Select Array
Constant shell
from the Array
subpalette
2. Place the data object in
the ar...
LV 46
Creating and Using Arrays
• Auto-Indexing –
loops accumulate
arrays at their
boundaries
• For Loops auto
index by de...
LV 47
Creating 2D Arrays
• Inner loop creates column elements
• Outer loop stacks them into rows
LV 48
Common Array Functions
Array Size
Initialize Array
Array Subset
LV 49
The Build Array Function
Building a higher dimension array
Concatenate Inputs (default)
Appending an element
LV 50
The Index Array Function
Extracting an Element
Extracting a Row
LV 51
Polymorphism
• Function inputs can be of different types
• All LabVIEW arithmetic functions are polymorphic
• Run Po...
LV 52
Graphs
• Selected from the Graph subpalette
• Waveform Graph – Plot an array of numbers
against their indices
• XY G...
LV 53
Single-Plot Waveform Graphs
Uniform X axis - initial X = 0.0, delta X = 1.0
Uniform X axis - you specify point spaci...
LV 54
Exercise 5
Students build Temperature Analysis.vi
LV 55
Case and Sequence Structures
A. About Case structures
B. About Sequence structures
D. How to replace Sequence struct...
LV 56
Case Structures
• In the Structures subpalette of Functions palette
• Enclose nodes or drag them inside the structur...
LV 57
Boolean and Numeric Cases
Note: all possible outputs of the Case structure must be wired
LV 58
Sequence Structures
• In the Structures subpalette of Functions palette
• Executes diagrams sequentially, Frame 0 (0...
LV 59
Sequence Locals
• Pass data from one frame to future frames
• Created at the border of the Sequence structure
Sequen...
Upcoming SlideShare
Loading in …5
×

Introduction to LabVIEW

4,425 views

Published on

Published in: Technology, Business

Introduction to LabVIEW

  1. 1. LV 1 Introduction to LabVIEW
  2. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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
  17. 17. LV 17 Exercise 1 Students build Convert C to F.vi * This VI will be used in a later exercise
  18. 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. 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
  20. 20. LV 20 Exercise Students modify and run Debug Exercise (Main).vi (Uses Debug Exercise (Sub).vi)
  21. 21. LV 21 Creating a SubVI A. What a SubVI is B. How to create the icon and connector C. How to use a VI as a subVI You Will Learn:
  22. 22. LV 22 SubVI Example – Calculating Slope
  23. 23. LV 23 Creating the Icon • Right-click in the icon pane (Panel or Diagram) and select “Edit Icon…” option
  24. 24. LV 24 Creating the Connector Right-click in the icon pane (Panel only)
  25. 25. LV 25 Creating the Connector - cont. Click
  26. 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. 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. 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. 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. 30. LV 30 Documenting the VI • Document VIs - VI Properties>>Documentation • Document objects - Description and Tip... VI Documentation Description and Tip
  31. 31. LV 31 Exercise 3 Students build Thermometer.vi *This VI will be used in a later exercise.
  32. 32. LV 32 The Create SubVI Option • Enclose area to be converted into a subVI • Select Create SubVI from the Edit Menu
  33. 33. LV 33 Loops and Charts A. About While Loops B. About waveform charts D. About For Loops You Will Learn:
  34. 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. 35. LV 35 Select the Loop Condition • Right-click on Conditional Terminal to define when the loop stops Iteration Terminal Conditional Terminal
  36. 36. LV 36 Waveform Charts • Selected from the Controls >> Graph subpalette
  37. 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
  38. 38. LV 38 Wiring to Charts • Single-Plot Chart • Multiple-Plot Chart
  39. 39. LV 39 Exercise 4 Students build Temperature Monitor.vi *This VI will be used in a later exercise.
  40. 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. 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. 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. 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. 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. 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. 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. 47. LV 47 Creating 2D Arrays • Inner loop creates column elements • Outer loop stacks them into rows
  48. 48. LV 48 Common Array Functions Array Size Initialize Array Array Subset
  49. 49. LV 49 The Build Array Function Building a higher dimension array Concatenate Inputs (default) Appending an element
  50. 50. LV 50 The Index Array Function Extracting an Element Extracting a Row
  51. 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. 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. 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
  54. 54. LV 54 Exercise 5 Students build Temperature Analysis.vi
  55. 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. 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. 57. LV 57 Boolean and Numeric Cases Note: all possible outputs of the Case structure must be wired
  58. 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. 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

×