Intro To Labview
Intro To Labview
3-Hour Hands-On
The Virtual Instrumentation Approach
LabVIEW Graphical Development System
• Graphical Programming Environment
• Compile code for multiple OS and devices
• Useful in a broad range of applications
Virtual Instrumentation Applications
• Design
– Signal and Image Processing
– Embedded System Programming A single graphical development platform
• (PC, DSP, FPGA, Microcontroller)
– Simulation and Prototyping Design Prototype Deploy
– And more…
• Control
– Automatic Controls and Dynamic Systems
– Mechatronics and Robotics
– And more…
• Measurements
– Circuits and Electronics
– Measurements and Instrumentation
– And more…
The NI Approach – Integrated Hardware Platforms
High-Speed High-Resolution Multifunction Dynamic Instrument Digital I/O Counter/ Machine Motion Distributed I/O and
Digitizers Digitizers and DMMs Data Acquisition Signal Acquisition Control Timers Vision Control Embedded Control
Signal Conditioning
and Switching
* The above table may not be representative of all device variations that exist in each category
What is MAX?
• MAX stands for Measurement & Automation Explorer.
• MAX configures and organizes all your National Instruments DAQ,
PCI/PXI instruments, GPIB, IMAQ, IVI, Motion, VISA, and VXI devices.
• Used for configuring and testing devices.
Icon Found on
Windows Desktop
Track A
Exercise 1 – Setting Up Your Device
• Use Measurement and Automation Explorer (MAX) to:
– Configure and test your Data Acquisition (DAQ) device
Track B
Exercise 1 – Setting Up Your Device
• Use Measurement and Automation Explorer (MAX) to:
– Configure and test your Simulated Data Acquisition (DAQ) device
Track C
Exercise 1 – Setting Up Your Device
• Use Windows to:
– Verify your Sound Card
Un-Mute Microphone
Open and Run LabVIEW
Start»All Programs»National Instruments LabVIEW 8.0
»
Startup Screen:
Start from a Blank VI:
New»Blank VI
or
Start from an Example:
Examples»Find
Examples…
LabVIEW Programs Are Called Virtual Instruments (VIs)
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
Controls Palette (Place items on the Front Panel Window)
(Controls & Indicators)
Control: Customize
Numeric Palette
View
Indicator:
Numeric Slide
Functions (and Structures) Palette
Structure:
While Loop
Status Toolbar
Run Button
Abort Execution
Additional Buttons on
the Diagram Toolbar
Graph
Indicator
Output
Terminal
Boolean
Control
Input
Terminals
Dataflow Programming
• Block diagram execution
– Dependent on the flow of data
– Block diagram does NOT execute
left to right
• Node executes when data is
available to ALL input terminals
• Nodes supply data to all output
terminals when done
Debugging Techniques
• Finding Errors
Click on broken Run button.
Window showing error appears.
• Execution Highlighting
Click on Execution Highlighting button; data
flow is animated using bubbles. Values are
displayed on wires.
• Probes
Right-click on wire to display probe and it shows
data as it flows through wire segment.
Additional Help
– Right-Click on the VI icon and
choose Help, or
– Choose “Detailed Help.” on the
context help window
Tips for Working in LabVIEW
• Keystroke Shortcuts
– <Ctrl+H> – Activate/Deactivate Context Help Window
– <Ctrl+B> – Remove Broken Wires From Block Diagram
– <Ctrl+E> – Toggle Between Front Panel and Block
Diagram
– <Ctrl+Z> – Undo (Also in Edit Menu)
• Tools»Options… – Set Preferences in LabVIEW
• VI Properties–Configure VI Appearance,
Documentation, etc.
Section II – Elements of Typical Programs
A. Loops
• While Loop
• For Loop
B. Functions and SubVIs
• Types of Functions
• Creating Custom Functions (SubVI)
• Functions Palette & Searching
C. Decision Making and File IO
• Case Structure
• Select (simple If statement)
• File I/O
Loops While Loop
• While Loops
– i terminal counts iteration
– Always runs at least once
– Runs until stop condition is met
For Loop
• For Loops
– i terminal counts iterations
– Run according to input N of
count terminal
Drawing a Loop
2. Enclose code to be repeated
2. Select
(a) (b)
(c)
File I/O
File I/O – passing data to and from files
• Files can be binary, text, or spreadsheet
• Write/Read LabVIEW Measurements file (*.lvm)
Functions»Express»Graph Indicators»Chart
Graphs – Display many data points at once
Waveform graph – special numeric indicator that displays an array of data
• Graph updates after all points have been collected
• May be used in a loop if VI collects buffers of data
Functions»Express»Graph Indicators»Graph
Building Arrays with Loops (Auto-Indexing)
• Loops can accumulate Auto-Indexing Enabled
Wire becomes thicker
arrays at their boundaries
with auto-indexing
• For Loops auto-index by
1D Array
default
• While Loops output only 012345
the final value by default
Auto-Indexing Disabled
• Right-click tunnel and
Wire remains the same size
enable/disable auto-
indexing
(Functions»Programming»
Structures»MathScript)
View/Modify
Variable Contents
User Commands
m-file Script
(LabVIEW»Tools»MathScript Window)
Track A,B,&C
Exercise 4.2 – Using MathScript
Use the MathScript Node and Interactive Window to process the
acquired signal (logarithmic decay) in the MathScript and save
the script.
(Terminal labels
reflect data type)
Bundle
Bundle By Name
Using Arrays and Clusters with Graphs
The Waveform Datatype contains 3 pieces of data:
• t0 = Start Time
• dt = Time between Samples
• Y = Array of Y magnitudes
Initial
Value Value 3
Before
Loop First Second Last
Begins Iteration Iteration Iteration
Local Variables
• Local Variables allow data to be passed between parallel loops.
• A single control or indicator can be read or written to from more than one
location in the program
– Local Variables break the dataflow paradigm and should be used sparingly
LabVIEW Navigation Window
(LabVIEW»Project»New)
Additional Resources
• NI Academic Web & Student Corner
– http://www.ni.com/academic
• LabVIEW Certification
– LabVIEW Fundamentals Exam (free on www.ni.com/academic)
– Certified LabVIEW Associate Developer Exam (industry recognized certification )
Associate Developer
• Proficiency in navigating
Certified LabVIEW Associate
LabVIEW environment Developer
• Some application
development experience
Fundamentals Exam
• Pre-Certification Skills Test Free On-Line Fundamentals Exam
Electronics Workbench and Multisim