Upload
miguel
View
236
Download
1
Embed Size (px)
Citation preview
8/10/2019 Introduction to LabVIEW Short
1/46
Introduction to LabVIEW
mailto:[email protected]:[email protected]:[email protected]://www.ni.com/8/10/2019 Introduction to LabVIEW Short
2/46
LabVIEW Graphical Development System
Useful in a broad range of applicationsCan compile code for multiple OS and devices
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
3/46
Virtual Instrumentation Applications Measurements
Circuits and Electronics Measurements and Instrumentation
Control
Plant modeling forControl
Automatic Controls and Dynamic Systems Mechatronics and Robotics
Design
Signal and Image Processing
Embedded System Programming
(PC, DSP, FPGA, Microcontroller)
Simulation and Prototyping
Design Prototype Deploy
A single graphical development platform
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
4/46
The NI Approach Integrated Hardware Platforms
High-SpeedDigitizers
High-ResolutionDigitizers and DMMs
MultifunctionData Acquisition
DynamicSignal Acquisition
Digital I/OInstrumentControl
Counter/Timers
MachineVision
MotionControl
Distributed I/O andEmbedded Control
Laptop PC PDADesktop PCPXI Modular Instrumentation
Signal Conditioning
and Switching
Unit Under Test
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
5/46
Section I LabVIEW EnvironmentLabVIEW Environment
Front Panel / Block Diagram Toolbar /Tools Palette
Data Flow Execution
Debugging Techniques
Components of a LabVIEW Application Creating a VI
C. Additional Help
Context Help Data Flow Execution
Debugging
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
6/46
Start>All Programs>National Instruments LabVIEW 8.6
On Getting Started Screen
open one of the following:
1. Blank VI: New>Blank VI
2. Empty Project: New>Empty Projects
3. Example: Examples>Find Examples
Open and Run LabVIEW
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
7/46
Each VI has2 Windows:
1. Front Panel
2. Block Diagram
LabVIEW Programs Are Called Virtual Instruments (VIs)
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
8/46
User Interface (UI)
Controls = Inputs Indicators = Outputs
VI Front Panel
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
9/46
Graphical Code
Data travels on wires fromcontrols through functions to
indicators
Blocks execute by Dataflow
VI Block Diagram
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
10/46
Controls Palette (Controls & Indicators)
Customize
Palette
View
(Places items on the Front Panel Window)
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
11/46
Controls Palette (Controls & Indicators)
Indicator:Numeric Slide
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
12/46
Controls Palette (Controls & Indicators)
Control:Numeric
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
13/46
Functions (and Structures) Palette(Places items on the Block Diagram Window)
Structure:While Loop
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
14/46
Run Button
Continuous Run Button
Abort Execution
Status Toolbar
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
15/46
Context Help Window
Help>Show Context Help or keys
Hover cursor over object to update window
Additional Help
Right-Click on the VI icon and
chooseHelp, or
Choose Detailed Help. on
the context help window
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
16/46
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 outputterminals when done
Dataflow Programming
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
17/46
Debugging Techniques
Finding Errors
Execution Highlighting
Probes
Click on broken Run button.
Window showing error appears.
Click on Execution Highlighting button; dataflow is animated using bubbles. Values aredisplayed on wires.
Right-click on wire to display probe and it showsdata as it flows through wire segment.
You can also select Probe tool from Tools paletteand click on wire.
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
18/46
Additional Buttons on
the Diagram Toolbar
Status Toolbar
Execution Highlighting Button
Retain Wire Values Button
Step Function Buttons
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
19/46
Section II Elements of Typical ProgramsFunctions
Types of Functions Functions Palette & Searching
Loops
While Loop For Loop
Decision Making and File IO Case Structure
Select (simple If statement)
File I/O
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
20/46
Types of Controls and Indicators Available
Numeric Data Number input and display
Analog Sliders, Dials, and Gauges
Boolean Data Buttons and LEDs
Ar ray & Matrix Data Numeric Display
Chart
Graph
XY Graph
Intensity Graph
3D graph: point, surface, and
model
Express Controls Palette
Decorations-Tab Control-Arrows
Other- Strings and text boxes- Picture/Image Display-ActiveX Controls
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
21/46
Types of Functions Available
Input and Output
Signal and Data Simulation Acquire and Generate Real Signals with DAQ
Instrument I/O Assistant (Serial & GPIB)
ActiveX for communication with other programs
Analysis Signal Processing
Statistics
Advanced Math and Formulas
Continuous Time Solver
Storage
File I/O
Express Functions Palette
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
22/46
Types of Functions (from the Functions Palette)
Functionsfundamental operating elements of LabVIEW;
no front panel or block diagram (yellow)
Express VIinteractive VIs with configurable dialog page (blue border)
Standard VI
modular VIs customized by wiring
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
23/46
Searching for Controls, VIs, and Functions
Palettes are filled with hundreds
of VIs
Press the search button to index the
all VIs for text searching
Click and drag an item from the
search window to the block diagram
Double-click an item to open the
owning palette
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
24/46
Loops
While Loopsi terminal counts iteration
Always runs at least once
Runs until stop condition is
met
For Loopsi terminal counts iterations
Run according to input N of
count terminal
While Loop
For Loop
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
25/46
Drawing a Loop
1. Select the structure
2. Enclose code to be repeated
3. Drop or drag additional nodes and then wire
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
26/46
Timing a Loop
1. Loop Time Delay
Configure the Time Delay Express VI for seconds to waiteach iteration of the loop (works on For and While loops).
2. Timed Loops Configure special timed While loop for desired dt.
Timed LoopTime Delay
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
27/46
Shift Register Access Previous Loop Data
Available at left or right border of loop structures
Right-click the border and selectAdd Shift Register Right terminal stores data on completion of iteration
Left terminal provides stored data at beginning of next iteration
BeforeLoop
BeginsFirst
IterationSecondIteration
LastIteration
Value 3InitialValue
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
28/46
Making Decisions
1. Case Structures
2. Select(a) (b)
(c)
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
29/46
Create SubVI
Enclose area to be converted into a subVI.
Select EditCreate SubVI from the Edit Menu.
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
30/46
LabVIEW Functions and SubVIs operate like subroutinesin other languages
Function Pseudo Codefunction average (in1, in2, out)
{
out = (in1 + in2)/2.0;
}
SubVI Block Diagram
Calling Program Pseudo Codemain
{
average (in1, in2, pointavg)
}
Call ing VI Block Diagram
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
31/46
Textual Math in LabVIEW
Integrate existing scripts with LabVIEW for faster development
Interactive, easy-to-use, hands-on learning environment
Develop algorithms, explore mathematical concepts, and
analyze results using a single environment
Freedom to choose the most effective syntax, whethergraphical or textual within one VI
Supported Math Tools:
MathScript script node MathSoft software
Mathematica software MATLAB softwareMaplesoftware Xmathsoftware
MATLAB is a registered trademark of The MathWorks, Inc.
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
32/46
Math with the MathScript Node
Implement equations and algorithms textually
Input and Output variables created at the border Generally compatible with popular m-file script language
Terminate statements with a semicolon to disable immediate
output
Prototype your equations in the interactive MathScript Window.
(FunctionsProgrammingStructuresMathScript)
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
33/46
The Interactive MathScript Window
Rapidly develop and test algorithms
(LabVIEWToolsMathScript Window)
OutputWindow
Variable
Workspace
View/Modify
Variable Contents
User Commands
m-file Script
Share Scripts andVariables with the Node
View /Modify Variable
content in 1D, 2D, and 3D
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
34/46
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)
Writing to LVMfile Reading from LVMfile
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
35/46
File I/O Programming Model Under the hood
Open/Create/
Replace File
Readand/or
Write to File
Close
File
Check for
Errors
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
36/46
Section III Presenting your Results
Displaying Data on the Front Panel Controls and Indicators
Graphs and Charts
Signal Processing - advanced
Arrays and clusters
Waveforms Projects
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
37/46
Control & Indicator Properties
Properties are characteristics or qualities about an object
Properties can be found by right clicking on a Control or Indicator Properties Include:
Size
Color
Plot Style
Plot color
Features include:
CursorsScaling
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
38/46
Graphs Display many data points at once
Waveform graph
special numeric indicator that displays an array ofdata
Graph updates after all points have been collected
May be used in a loop if VI collects buffers of dataFunctionsExpressGraph IndicatorsGraph
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
39/46
Charts Add 1 data point at a time with historyWaveform chart special numeric indicator that can display a historyof valuesChart updates with each individual point it receives
FunctionsExpressGraph IndicatorsChart
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
40/46
Advanced topics
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
41/46
Introduction to Clusters
Data structure that groups data together Data may be of different types
Analogous to struct in C
Elements must be either all controls or all indicators Thought of as wires bundled into a cable
Order is important
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
42/46
Arrays and Clusters into Graphs
The Waveform Datatype contains 3 pieces of data: t0 = Start Time
dt = Time between Samples
Y = Array of Y magnitudes
Two ways to create a Waveform Cluster:
Build Waveform (absolute time) Cluster (relative time)
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
43/46
LabVIEW Project
Group and organize VIsHardware and I/O management
Manage VIs for multiple targets
Build libraries and executables
Manage large LabVIEW applications
Enable version tracking and management
(LabVIEW>Project>New)
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
44/46
Additional Resources NI Academic Web & Student Corner
http://www.ni.com/academic
Connexions: Full LabVIEW Training Course
www.cnx.rice.edu
Or search for LabVIEW basics
LabVIEW Certification
LabVIEW Fundamentals Exam (free on www.ni.com/academic)
Certified LabVIEW Associate Developer Exam (industry recognized certification )
Get your own copy of LabVIEW Student Editionwww.ni.com/academic
ByRobert H Bishop.
Published byPrentice Hall.
http://www.ni.com/academichttp://www.cnx.rice.edu/http://cnx.rice.edu/content/col10241/latest/http://www.ni.com/academichttp://www.ni.com/academichttp://www.phptr.com/authors/bio.asp?a=680855aa-0b6f-441f-8280-53f8f7b5f51bhttp://vig.prenhall.com/http://vig.prenhall.com/http://www.phptr.com/authors/bio.asp?a=680855aa-0b6f-441f-8280-53f8f7b5f51bhttp://www.ni.com/academichttp://www.ni.com/academichttp://cnx.rice.edu/content/col10241/latest/http://www.cnx.rice.edu/http://www.ni.com/academichttp://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
45/46
The LabVIEW Certification Program
Certified LabVIEW
Developer
Certif ied LabVIEW Associate
Developer
CertifiedLabVIEW
Arch itect
Architect
Mastery of LabVIEW Expert in large application development
Skilled in leading project teams
Developer Advanced LabVIEW knowledge
and application development
experience Project management skills
Associate Developer Proficiency in navigating
LabVIEW environment
Some applicationdevelopment experience
Fundamentals ExamPre-Certification Skills Test Free On-Line Fundamentals Exam
http://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/8/10/2019 Introduction to LabVIEW Short
46/46
http://www.labviewjobs.com/index.php
http://www.labviewjobs.com/index.phphttp://www.labviewjobs.com/index.phphttp://www.ni.com/http://c/eluther/www.ni.com/http://c/eluther/ni.com/