Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 68

Dai hoc Khoa hoc Tu nhin

Khoa Din tu - Vin thng


0 1
'
V Phung Thi Thuy Hng
Section
LabVEW terms
Components of a LabVEW application
LabVEW programming tools
Creating an application in LabVEW
Front PaneI
W ControIs = nputs
W ndicators = Outputs
Iock Diagram
W ccompanying "program" for front
paneI
W Components "wired" together
Virtual nstruments (Vs)
V Front Panel
Frorl Pare|
Too|oar
0rapr
Legerd
8oo|ear
Corlro|
wavelorr
0rapr
lcor
P|ol
Legerd
3ca|e
Legerd
V Block Diagram
w|re
0ala
0rapr
Terr|ra|
3uovl
wr||e Loop
3lruclure
8|oc|
0|agrar
Too|oar 0|v|de
Furcl|or
Nurer|c
Corslarl
T|r|rg
Furcl|or
8oo|ear Corlro|
Terr|ra|
Controls and Functions Palettes
ControIs PaIette
(Front PaneI indow)
Functions PaIette
(Iock Diagram indow)
Operating TooI
Positioning/Resizing TooI
abeIing TooI
iring TooI
Shortcut Menu TooI
W FIoating PaIette
W Used to operate and modify front paneI
and bIock diagram objects.
ScroIIing TooI
reakpoint TooI
Probe TooI
CoIor Copy TooI
CoIoring TooI
%ools Palette
utomatic SeIection TooI
Run utton
Continuous Run utton
bort ecution
Pause/Continue utton
Tet Settings
Iign Objects
Distribute Objects
Reorder
Resize front paneI
objects
ecution HighIighting
utton
Step nto utton
Step Over utton
Step Out utton
dditionaI uttons on
the Diagram TooIbar
Status %oolbar
pen and Run a Virtual nstrument
ampIe finder
Control
%erminals
Iock Diagram indow
Front PaneI indow
ndicator
%erminals
Creating a V
Creating a V Block Diagram
Wiring %ips Block Diagram
iring "Hot Spot"
CIean Up iring
Use utomatic
ire Routing
CIick To SeIect ires
Do Not DeIete This Do Not DeIete This
SIide SIide
W 8|oc| d|agrar execules
deperderl or lre l|oW ol dala;
o|oc| d|agrar does N0T
execule |ell lo r|grl
W Node execules Wrer dala |s
ava||ao|e lo ALL |rpul lerr|ra|s
W Nodes supp|y dala lo a|| oulpul
lerr|ra|s Wrer dore
0ataf|ow Programm|ng.
elp ptions
Contet HeIp
W OnIine heIp
W ock heIp
W SimpIe/CompIe Diagram heIp
W CtrI + H
OnIine reference
W II menus onIine
W Pop up on functions in diagram to access onIine info directIy
Debugging %echniques
W Finding rrors
W ecution HighIighting
W Probe
CIick on broken Run button
indow showing error appears
CIick on ecution HighIighting button; data
fIow is animated using bubbIes. 'aIues are
dispIayed on wires.
Right-cIick on wire to dispIay probe and it
shows data as it fIows through wire segment
You can aIso seIect Probe tooI from TooIs
paIette and cIick on wire
Section SubVs
What is a subV?
Making an icon
and connector for
a subV
Using a V as a
subV
Block Diagram Nodes
lcor Expardao|e Node Exparded Node
W Furcl|or 0ereralor vl
W 3are vl, v|eWed lrree d|llererl Ways
W e||oW l|e|d des|grales a slardard vl
W 8|ue l|e|d des|grales ar Express vl
SubVs
A SubV is a V that can be used within another V
Similar to a subroutine
Advantages
Modular
Easier to debug
Don't have to recreate code
Require less memory
con and Connector
n icon represents a ' in
other bIock diagrams
connector shows avaiIabIe
terminaIs for data transfer
con
Connector
TerminaIs
SubVs
Sub Vs Sub Vs
Steps to Create a SubV
Create the con
Create the Connector
Assign %erminals
Save the V
nsert the V into a %op Level V
Create the con
Right-click on the icon in the block diagram or
front panel
Create the Connector
Right cIick on the icon pane (front paneI onIy)
Assign %erminals
Save %he V
Choose an Easy to Remember Location
rganize by Functionality
Save Similar Vs into one directory (e.g. Math Utilities)
rganize by Application
Save all Vs Used for a Specific Application into one
directory or library file (e.g. Lab 1 Frequency
Response)
Library Files (.llbs) combine many V's into a single file, ideal
for transferring entire applications across computers
nsert the SubV into a %op Level V
ccessing user-made sub's
Functions >>II Functions >> SeIect a '
Or
Drag icon onto target diagram
%ips for Working in LabVEW
Keystroke Shortcuts
Ctrl- Activate/Deactivate Context elp Window
Ctrl-B Remove Broken Wires From Block
Diagram
Ctrl-E %oggle Between Front Panel and Block
Diagram
Ctrl-Z Undo (Also in Edit Menu)
%ools ptions. Set Preferences in
LabVEW
V Properties Configure V Appearance,
Documentation, etc.
Section Data Acquisition
Data acquisition (DAQ) basics
Connecting Signals
Simple DAQ application
Computer
DAQ Device
%erminal Block
Cable
Sensors
0ata Acqu|s|t|on |n LabV|Ew
Trad|t|ona| N|-0A0
3pec|l|c vls lor perlorr|rg:
W Ara|og lrpul
W Ara|og 0ulpul
W 0|g|la| l/0
W Courler operal|ors
N|-0A0mx
Nexl gereral|or dr|ver:
W vls lor perlorr|rg a
las|
W 0re sel ol vls lor a||
reasurererl lypes
DAQ Data Acquisition
%emperature Acquisition using the DAQ Assistant
Data Acquisition %erminology
ResoIution - Determines ow Many Different Voltage
Changes Can Be Measured
Larger Resolution More Precise Representation of Signal
Range - Minimum and Maximum Voltages
Smaller range More Precise Representation of Signal
ain - Amplifies or Attenuates Signal for Best Fit in
Range
ardware Connections
NC-2120
SC-68
N-'S
SC-2075
Section V Loops and Charts
For Loop
While Loop
Charts
Multiplots
Loops
While Loops
ave teration %erminal
Always Run at least nce
Run According to
Conditional %erminal
For Loops
ave teration %erminal
Run According to input N of
Count %erminal
Loops
3e|ecl lre |oop 2 Erc|ose code lo oe repealed
3 0rop or drag add|l|ora| rodes ard lrer W|re
Charts
Waveform chart special
numeric indicator that can
display a history of values
ControIs >> raph ndicators
>> aveform Chart
Wiring Data into Charts
Single Plot Charts
Multiplot Charts
Section V Arrays & File /
Build arrays manually
ave LabVEW build arrays automatically
Write to a spreadsheet file
Read from a spreadsheet file
Adding an Array to the Front Panel
From the ControIs >> II ControIs >> rray and CIuster
subpalette, select the rray SheII
0rop |l or lre screer
Adding an Array
Place data object into shell (i.e. Numeric Control)
Creating an Array with a Loop
Loops accumulate arrays at their boundaries
Creating 2D Arrays
File /
FiIe /O passing data to and from files
- Files can be binary, text, or spreadsheet
- Write/Read LabVEW Measurements file (*.lvm)
Writing to LVM file Writing to LVM file Reading from LVM file Reading from LVM file
Write LabVEW Measurement File
ncludes the open, write, close and error handling functions
andles formatting the string with either a tab or comma
delimiter
Merge Signals function is used to combine data into the
dynamic data type
Section V Array Functions & Graphs
Basic Array Functions
Use graphs
Create multiplots with graphs
Array Functions Basics
Functions >> II functions>> rray Functions >> II functions>> rray
Array Functions Build Array
Graphs
Selected from the Graph palette of Controls menu
ControIs>>II ControIs>>raphs
Waveform Graph Waveform Graph Plot an array of Plot an array of
numbers against their indices numbers against their indices
Express XY Graph Express XY Graph Plot one array Plot one array
against another against another
Digital Waveform Graph Digital Waveform Graph Plot bits Plot bits
from binary data from binary data
Do Not DeIete This SIide Do Not DeIete This SIide
Graphs
Right-Click on the Graph and choose Properties to
nteractively Customize
Section V Strings, Clusters, & Error andling
Strings
Creating CIusters
CIuster Functions
rror /O
Strings
W A slr|rg |s a sequerce ol d|sp|ayao|e or rord|sp|ayao|e
craraclers (A3Cll)
W ary uses - d|sp|ay|rg ressages, |rslrurerl corlro|, l||e
l/0
W 3lr|rg corlro|/|rd|calor |s |r lre ontro|s Text ontro| or
Text |nd|cator
Clusters
Data structure that groups data together
Data may be of different types
Analogous to 897:.9 in C
Elements must be either all controls or all
indicators
%hought of as wires bundled into a cable
Creating a Cluster
1. Select a CIuster shell
ControIs >> II ControIs >> rray &
CIuster
2 P|ace oojecls |rs|de lre sre||
Cluster Functions
W n the CIuster subpalette of the Functions>>II functions palette
W Can also be accessed by right-clicking on the cluster terminal
undIe
(%erminal labels
reflect data type)
undIe y Name
Cluster Functions
UnbundIe
UnbundIe y Name
UnbundIed cIuster
in the diagram
Error Clusters
Error cluster contains the following information:
Boolean to report whether error occurred
nteger to report a specific error code
String to give information about the error
Error andling %echniques
Error information is passed from one subV to the next
f an error occurs in one subV, all subsequent subVs
are not executed in the usual manner
Error Clusters contain all error conditions
Automatic Error andling
error cIusters
Section V - Case & Sequence
Structures, Formula Nodes
Case Structures
n the Structures subpalette of Functions palette
Enclose nodes or drag them inside the structure
Stacked like a deck of cards, only one case visible
Functions >> ecution controI
Sequence Structures
n the ecution ControI subpalette of Functions
palette
Executes diagrams sequentially
Right-click to add new frame
Formula Nodes
n the Structures subpalette
mplement complicated equations
Variables created at border
Variable names are case sensitive
Each statement must terminate with a semicolon (;)
Context elp Window shows available functions
Note semicoIon
Section X Basic Programming Architecture
Simple V Architecture
General V Architecture
State Machine Architecture
Simple V Architecture
Functional V that produces results when run
No "start or "stop options
Suitable for lab tests, calculations
Example: Convert C to F.vi
General V Architecture
%hree Main Steps
Startup
Main Application
Shutdown
State Machine Architecture
Advantages
Can go from any state from
any other
Easy to modify and debug
Disadvantages
Can lose events if two occur at
the same time
States:
0: Startup
1: dIe
2: vent 1
3: vent 2
4: Shutdown

You might also like