Sei sulla pagina 1di 31

Exercise 1: Open and Run Todays Final LabVIEW Application

1oday's exerclses revolve around creaLlng a LemperaLure monlLorlng appllcaLlon LhaL wlll wrlLe Lhe acqulred daLa Lo flle
and ouLpuL a dlglLal warnlng slgnal lf Lhe LemperaLure goes above an ad[usLable warnlng level.
1hls exerclse glves you a chance Lo see whaL you'll compleLe by Loday's flnal appllcaLlon. ?ou'll also explore lmporLanL
elemenLs of Lhe LabvlLW envlronmenL.
1. lf you have noL already done so, launch LabvlLW. Cllck Lhe LabVILW lcon on your qulck launch Loolbar, or cllck Start
rograms Nat|ona| Instruments LabVILW 8.6.

Cnce you launch LabvlLW, Lhe CeLLlng SLarLed wlndow appears:

1he LabvlLW CeLLlng SLarLed wlndow appears each Llme you launch LabvlLW Lo asslsL you ln creaLlng new appllcaLlons
or openlng exlsLlng appllcaLlons. AddlLlonally you can use llnks on Lhe CeLLlng SLarLed wlndow Lo flnd local and onllne
help resources or open example programs Lo ald ln appllcaLlon deslgn.
2. Cpen Lhe lnLro Lo LabvlLW-uAC Pands-on.lvpro[" ro[ecL ln Lhe Cpen secLlon of Lhe CeLLlng SLarLed wlndow or
navlgaLe Lo lL by presslng 8rowse." llnk and golng Lo xxxxxxxxxxxxx. Cnce opened, Lhe lnLro Lo LabvlLW-uAC
Pands-on" ro[ecL Lxplorer looks llke Lhls:
aryan 8/19/08 9:35 PM
Deleted:

1he ro[ecL Lxplorer provldes a cenLral locaLlon for you Lo lnclude Lhe dlfferenL elemenLs of an appllcaLlon lncludlng
LabvlLW code and oLher flles llke MlcrosofL Word and Lxcel documenLs. ?ou can lnclude any flle ln a LabvlLW
appllcaLlon. ?ou can creaLe folders and sub-folders Lo organlze Lhe flles ln an appllcaLlon. Pere, a few folders have been
creaLed as parL of Lhe example.
3. Lxpand Lhe SoluLlons" folder ln Lhe ro[ecL Lxplorer and open Lhe 3-WrlLe Lo llle (SoluLlon).vl" by double-cllcklng on
lL or rlghL-cllcklng and selecLlng Cpen." 1he program's user lnLerface (fronL panel"). Lvery LabvlLW appllcaLlon ls
made of a fronL panel and a block dlagram. 1he fronL panel ls Lhe user lnLerface, whereas Lhe block dlagram conLalns
Lhe code LhaL conLrols Lhe funcLlonallLy of your appllcaLlon. ?ou can Loggle beLween Lhe Lwo wlndows by selecLlng
W|ndow Show 8|ock D|agram or W|ndow Show Iront ane|. ?ou can also swlLch beLween Lhe wlndows by presslng
<CLrl-L> on Lhe keyboard or cllcklng on elLher wlndow lf boLh are presenL on your monlLor.


Pover Lhe cursor over Lhe dlfferenL ob[ecLs on Lhe fronL panel. noLlce LhaL your cursor Lurns Lo a polnLer flnger when
above Lhe SLop buLLon, and Lurns Lo a LexL edlLor when above a LexL fleld. 8y defaulL, LabvlLW's AuLomaLlc 1ool
SelecLlon wlll change Lhe cursor dependlng on whaL operaLlons are posslble. Also noLlce LhaL as you move over any
ob[ecL, reslzlng boxes appear on lLs edges. 1ry reslzlng a few ob[ecLs' slzes.

4. noLlce Lhe menu bar aL Lhe Lop of Lhe wlndow. We wlll dlscuss many of lLs baslc lLems ln fuLure pages and exerclses.
lor now, Lhe mosL lmporLanL buLLon Lo revlew ls Lhe 8un" buLLon, found on Lhe lefL edge of Lhe menu bar.

?ou musL press Lhe 8un buLLon Lo begln any LabvlLW appllcaLlon, and a broken run arrow Lells you LhaL Lhere are some
unresolved errors ln Lhe code. Slnce LabvlLW ls conLlnually complllng code LhroughouL developmenL, you can press Lhe
broken 8un buLLon aL any Llme and a llsL of currenL errors wlll appear.
3. Make sure LhaL your CompacLuAC chassls ls powered on, LhaL lL's connecLed Lo your C wlLh a uS8 cable and LhaL all
four modules are plugged ln squarely Lo Lhe chassls. now press Lhe 8un buLLon ln Lhe LabvlLW appllcaLlon and waLch as
Lhe appllcaLlon beglns Lo record LemperaLure daLa from Lhe module plugged lnLo Lhe flrsL sloL of Lhe CompacLuAC
chassls. ConLacL Lhe lnsLrucLor lf your appllcaLlon lsn'L runnlng as descrlbed.
Pold Lhe end of Lhe Lhermocouple and waLch Lhe values on Lhe graph rlse and fall accordlngly. Change Lhe Alarm
Level" conLrol Lo dlfferenL values and hold Lhe Lhermocouple so LhaL lL rlses above and below Lhe value you've enLered
on Lhe fronL panel.
As LemperaLure rlses and falls around Lhe Alarm Level, look aL Lhe nl 9472 module ln Lhe CompacLuAC chassls. Cne
dlglLal ouLpuL llne on Lhls module has been programmed Lo drlve a 3v slgnal whenever LemperaLure ls greaLer Lhan Lhe
value of Alarm Level. 1he module's LLus lndlcaLe Lhe sLaLus of each dlglLal llne. 1hese llnes could be connecLed Lo oLher
hardware, llke a llghL or buzzer, or oLher 3v devlce
6. ress Lhe SLop buLLon on Lhe fronL panel once you are ready Lo move on.
navlgaLe Lo Lhe block dlagram.

LabvlLW's graphlcal programmlng makes appllcaLlon execuLlon lnLulLlve. ln Lhls case our appllcaLlon does Lhe followlng:
1. Acqulres LemperaLure daLa wlLh Lhe uAC AsslsLanL and dlsplays lL on a charL
2. Compares acqulred daLa wlLh Alarm Level
3. CuLpuLs 0v or 3v Lo Lhe dlglLal ouLpuL module based on Lhe comparlson ln #2
4. WrlLes acqulred daLa Lo flle.
8. ulsLrlbuLe Lhe fronL panel and block dlagram wlndows so LhaL boLh are vlslble ln your monlLor. Cnce creaLed,
navlgaLe Lo W|ndow 1||e Left and k|ght Lo Llle Lhe fronL panel and block dlagram on your monlLor, or press <CLrl + 1>.
noLlce LhaL for every ob[ecL on Lhe fronL panel, Lhere ls a Lermlnal wlLh Lhe same name on Lhe block dlagram. 1he
funcLlons and wlres on Lhe block dlagram connecL Lhe lnpuLs (conLrols") and ouLpuLs (lndlcaLors") on Lhe fronL panel.
As you add ob[ecLs Lo Lhe fronL panel ln fuLure exerclses you'll see LhaL Lermlnals are auLomaLlcally creaLed on Lhe block
dlagram.
Add|t|ona| Steps
9. 1he LabvlLW help sysLem ls a greaL way Lo learn abouL LabvlLW and answer your programmlng quesLlons. ress
<l1> on Lhe keyboard Lo sLarL Lhe help sysLem. More asslsLance can be found from Lhe LabvlLW Pelp menu.
<8.6 Pelp maln screen S1lLL nLLu l8CM 81M vL8SlCn>
11. Lxpand Iundamenta|s LabVILW Lnv|ronment and explore Lhe lnformaLlon avallable here, cllck around and geL a
feel for how lL ls organlzed.

12. 1ake a few mlnuLes Lo explore oLher Loplcs ln Lhe help sysLem.
13. Cllck on Lhe Search Lab Lry searchlng on analysls funcLlons for feaLures you mlghL need ln your work appllcaLlons.
Lnd of Lxerc|se 1


Exercise 2: Simulate a Signal and Output to a Chart
1hls exerclse wlll revlew Lhe LabvlLW envlronmenL baslcs you have learned so far. ?ou wlll creaLe an appllcaLlon LhaL
slmulaLes a slgnal lnslde of LabvlLW and dlsplay LhaL slgnal Lo a charL.
1. Cpen a blank vl from Lhe lnLro Lo LabvlLW-uAC Pands-on ro[ecL Lxplorer by rlghL-cllcklng on Lhe Lxerclses" folder
and selecLlng New VI.


3. Add a Whlle Loop Lo Lhe block dlagram. 8lghL-cllck on any empLy space on Lhe block dlagram Lo brlng up Lhe
luncLlons paleLLe, and Lhen navlgaLe Lo rogramm|ng Structures Wh||e Loop. LefL-cllck on Lhe Whlle loop and lL wlll
be auLomaLlcally placed on your cursor.

Cllck and Lhen drag dlagonally Lo form Lhe Whlle loop Lo Lhe area you deslre. ?ou can reslze Lhe Whlle loop by dragglng
any of Lhe reslzlng boxes LhaL appear when your cursor hovers above Lhe loop's edges.
3a. ?ou can also creaLe a Whlle loop by presslng <CLrl + Space 8ar> Lo brlng up Lhe Culck urop dlalog. 8egln Lyplng
Whlle Loop" and lL wlll appear ln Lhe llsL of posslble ob[ecLs. uouble-cllck on lLs name and lL wlll appear on your cursor
for use on Lhe block dlagram. Slnce you've already placed Lhe whlle loop, release Lhe whlle loop you found uslng Culck
urop by rlghL-cllcklng.

4. Whlle loops have Lwo Lermlnals ln Lhelr boLLom lefL and rlghL corners.

1he mosL lmporLanL of Lhe Lwo ls Lhe loop condlLlon . 1he condlLlonal Lermlnal ls on Lhe lower rlghL slde. Slnce
whlle loops run unLll Lold Lo sLop, we musL provlde some klnd of sLop command so LhaL Lhe loop won'L run lndeflnlLely.
noLlce Lhe broken run arrow ln Lhe upper lefL of Lhe screen. LabvlLW cannoL execuLe an appllcaLlon LhaL conLalns a
whlle loop wlLh an un-wlred condlLlonal Lermlnal (fuzzy). lor our appllcaLlon, we need Lo creaLe a sLop buLLon LhaL Lhe
user wlll press Lo halL Lhe whlle loop and exlL Lhe program.
Cn Lhe fronL panel, rlghL cllck on any empLy space Lo brlng up Lhe ConLrols paleLLe and navlgaLe Lo Modern 8oo|ean
Stop 8utton. LefL cllck on Lhe sLop buLLon and lL wlll be auLomaLlcally placed on your cursor.

LefL-cllck where you would llke Lo place lL on Lhe fronL panel. Lnlarge Lhe SLop buLLon by movlng your cursor Lo one of
Lhe buLLon's edges and dragglng Lhe reslzlng boxes.
3. Look agaln aL Lhe block dlagram. noLlce LhaL a Lermlnal for Lhe sLop buLLon has appeared. 1hls Lermlnal acLs as Lhe
connecLor from Lhe fronL panel Lo Lhe funcLlonallLy of Lhe block dlagram. Cllck on Lhe sLop Lermlnal and drag lL nexL Lo
Lhe loop condlLlon Lermlnal ln Lhe Whlle loop.
6. Move your cursor Lo Lhe rlghL edge of Lhe sLop Lermlnal and noLlce LhaL Lhe edge of Lhe Lermlnal ls bllnklng and Lhe
cursor now looks llke a spool. 1hls ls Lhe wlrlng Lool LhaL leLs you draw wlres beLween dlfferenL ob[ecLs on Lhe block
dlagram. LefL-cllck on Lhe edge of Lhe sLop Lermlnal and drag Lhe cursor unLll you are hoverlng over Lhe lefL edge of Lhe
Whlle loop's condlLlon Lermlnal, and Lhen release. 1he wlre ls now connecLed beLween Lhe sLop Lermlnal and Lhe
condlLlonal Lermlnal.

WlLh Lhe Whlle loop now havlng a way Lo exlL, Lhe broken 8un arrow ls replaced wlLh a 8un arrow and your appllcaLlon
ls ready Lo run, buL you'll need Lo add more code Lo accompllsh Lhe Lasks of Lhls exerclse.
6a. 1he oLher Lermlnal ln Lhe whlle loop, Lhe loop lLeraLlon counLer , ouLpuLs Lhe number of Llmes Lhe Whlle loop has
lLeraLed. 1haL lnformaLlon may be useful dependlng on your appllcaLlon, buL we wlll noL be uslng lL Loday, nor ls lL
requlred LhaL we do anyLhlng wlLh lL ln order Lo run our program.
7. CreaLe a slmulaLed slgnal. ress <CLrl + Space 8ar> Lo brlng up Lhe Culck urop dlalog and begln Lo Lype SlmulaLe
Slgnal." uouble-Cllck SlmulaLe Slgnal" once you see lL ln Lhe box below where you are Lyplng and Lhe SlmulaLe Slgnal
Lxpress vl wlll auLomaLlcally appear on your cursor.

8. LefL-cllck Lo place Lhe SlmulaLe Slgnal Lxpress vl lnslde Lhe Whlle loop and lLs conflguraLlon dlalog wlll appear.

9. Change Lhe Slgnal 1ype, AmpllLude, lrequency, CffseL and hase values ln Lhe Slgnal porLlon of Lhe dlalog and see Lhe
changes ln Lhe 8esulLs revlew porLlon. ueselecL Lhe use slgnal Lype name" box ln Lhe Slgnal name secLlon and enLer
SlmulaLed Slgnal" as Lhe name.
Cnce you have chosen Lhe slgnal you wanL Lo dlsplay, press Ck." 1he SlmulaLe Slgnal Lxpress vl has now been
cusLomlzed based on Lhe seLLlngs you provlded.
10. ConnecL Lhe slmulaLed slgnal Lo a charL. Move Lo Lhe fronL panel and brlng up Lhe Culck urop dlalog and Lype Lhe
word charL." lace Lhe Waveform CharL on Lhe fronL panel aL Lhe locaLlon you prefer.
11. 8eLurn Lo Lhe block dlagram and move Lhe charL's lcon lnLo Lhe Whlle loop, Lo Lhe rlghL of Lhe SlmulaLe Slgnal
Lxpress vl. ConnecL Lhe ouLpuL of Lhe SlmulaLe Slgnal Lxpress vl (SlmulaLed Slgnal") Lo Lhe charL Lermlnal. noLlce LhaL
Lhe charL Lermlnal changed colors Lo reflecL Lhe daLa Lype lL recelved.

12. 8eLurn Lo Lhe fronL panel and run Lhe vl. 1he slmulaLed slgnal you creaLed ln Lhe Lxpress vl ls now dlsplayed on Lhe
charL. ress Lhe SLop buLLon when you are ready Lo move on.
13. Add conLrols Lo ad[usL slgnal frequency and ampllLude whlle Lhe program ls runnlng. 8lghL-cllck on an empLy space
on Lhe fronL panel Lo brlng up Lhe ConLrols paleLLe, flnd Lhe knob conLrol (Modern numerlc knob) and place lL on Lhe
fronL panel. uouble-cllck on Lhe knob's label and change lL Lo AmpllLude."
14. 8epeaL sLep #13 Lo make anoLher knob for frequency. Change lLs label Lo lrequency. uouble-cllck Lhe maxlmum
value on lrequency's scale and change lL Lo 30.

lronL anel 8lock ulagram
13. Cn Lhe block dlagram, move Lhe AmpllLude and lrequency conLrols lnslde of Lhe whlle loop and connecL Lhem Lo Lhe
assoclaLed lnpuLs of Lhe SlmulaLe Slgnal Lxpress vl. Cnce boLh Lermlnals are lnslde Lhe whlle loop, on Lhe lefL slde of Lhe
SlmulaLe Slgnal Lxpress vl, hover your cursor over Lhe rlghL slde of each Lermlnal unLll Lhe wlrlng Lool appears on Lhe
cursor. LefL-cllck and drag Lhe connecLlon Lo Lhe ldenLlcally named lnpuL on Lhe Lxpress vl. ?our block dlagram should
look llke Lhe lmage above.
16. 8un Lhe vl. ress Lhe run arrow and manlpulaLe AmpllLude and lrequency and noLlce Lhe charL dlsplay changes
accordlngly. 1he CharL's y-axls auLo-scales Lo maxlmlze Lhe slgnals slze on Lhe dlsplay. 1o dlsable LhaL feaLure, rlghL cllck
on Lhe charL and deselecL AuLoScale ?."

?ou can now change Lhe upper and lower ranges of Lhe ?-axls by cllcklng on Lhe numbers along Lhe axls and Lyplng ln
new values.
17. SLop Lhe vl by presslng Lhe sLop buLLon.
Add|t|ona| Steps (May want to cons|der chang|ng these from "Add|t|on Steps" to "ne|pfu| 1|p" s|nce the user |sn't
necessar||y tak|ng any act|on. If you do e|ect to change |t you may want to not use a numbered ||st
LabvlLW provldes several Lools LhaL can help you develop your appllcaLlons. 1he nexL few sLeps wlll show how Lo use
some of Lhe mosL lmporLanL programmlng asslsLance Lools.
!"#$% '()*+), -".)/01
18. use 8lock ulagram Cleanup Lo organlze your block dlagram. As you program, and especlally as you learn how Lo
program ln LabvlLW, you are noL always Lhlnklng abouL layouL and readablllLy. 1hls can resulL ln poorly organlzed block
dlagram.
LabvlLW's 8lock ulagram Cleanup ls a bullL-ln Lool LhaL organlzes your code, maklng lL easler for you and oLhers Lo
undersLand how your program funcLlons. ress Lhe 8lock ulagram Cleanup lcon found on Lhe menu bar.

?our block dlagram should now be organlzed, wlLh cleaner wlres and an even dlsLrlbuLlon of code elemenLs.
1o cusLomlze how Lhe 8lock ulagram Cleanup Lool organlzes your code, change seLLlngs ln Lhe 8lock ulagram: Cleanup"
secLlon of Lhe CpLlons menu aL 1oo|s Cpt|ons..

1hls menu leLs you cusLomlze how far wlres, sLrucLures, funcLlons and Lermlnals wlll be spaced from each oLher and
from Lhe edges of your block dlagram. Cllck Ck when you are ready Lo move on.
2(*3"(*34 56.$04(#/
13. use PlghllghL LxecuLlon Lo observe how your appllcaLlon runs. ress Lhe PlghllghL LxecuLlon buLLon on Lhe menu
bar. noLlce LhaL Lhe llghL bulb lcon now appears Lo be on.

16. 8un your appllcaLlon wlLh PlghllghL LxecuLlon Lurned on. ress Lhe run arrow and waLch as your code execuLes
sLep-by-sLep. Whlle noL always necessary for slmple appllcaLlons, Lhe PlghllghL LxecuLlon Lool ls a powerful resource for
Lrouble shooLlng complex programs and deLermlnlng lf your code performs as expecLed.
-#/4.64 2."1
18. use ConLexL Pelp Lo ldenLlfy ob[ecL deLalls whlle programmlng. ress Lhe ConLexL Pelp buLLon ln Lhe upper rlghL
porLlon of Lhe block dlagram.

19. WlLh Lhe ConLexL Pelp acLlve, hover your cursor over dlfferenL ob[ecLs on Lhe block dlagram and fronL panel of
SlmulaLe Slgnal Lo Craph.vl. As you do so, Lhe ConLexL Pelp Wlndow provldes deLalls lncludlng descrlpLlons and wlrlng
dlagrams.

20. 8lghL-cllck on Lhe block dlagram and navlgaLe around Lhe paleLLes. noLlce LhaL Lhe ConLexL Pelp wlndow provldes
deLalls on Lhe ob[ecLs whlle Lhey are ln Lhe paleLLes. Also noLlce LhaL for some ob[ecLs, Lhe ConLexL Pelp wlndow
provldes a llnk for ueLalled Pelp." 1hls llnk wlll open Lhe Lv Pelp and glve you more lnformaLlon.
21. Save 2-SlmulaLe Slgnal Lo Craph.vl and close.
Lnd of Lxerc|se #2







Exercise 3: Take a Basic Measurement with CompactDAQ
1he purpose of Lhls exerclse ls Lo use LabvlLW and nl CompacLuAC Lo qulckly seL up a program Lo acqulre LemperaLure
daLa.
Set up the nardware
1. Make sure LhaL Lhe nl CompacLuAC chassls (cuAC-9172) ls powered on.

2. ConnecL Lhe chassls Lo Lhe C uslng Lhe uS8 cable.
3. 1he nl-uACmx drlver lnsLalled on Lhe C auLomaLlcally deLecLs Lhe chassls and brlngs up Lhe followlng wlndow.

4. Cllck on Conflgure and 1esL 1hls uevlce uslng nl MeasuremenL & AuLomaLlon Lxplorer.
Note: NI Measurement & Automat|on Lxp|orer |s a conf|gurat|on ut|||ty for a|| Nat|ona| Instruments hardware.
3. 1he uevlces and lnLerfaces secLlon under My SysLem shows all Lhe naLlonal lnsLrumenLs devlces lnsLalled and
conflgured on your C. 1he nl-uACmx uevlces folder shows all Lhe nl-uACmx compaLlble devlces. 8y defaulL, Lhe nl
CompacLuAC chassls nl cuAC-9172 shows up wlLh Lhe name cuAC1".
6. 1hls secLlon of MAx also shows Lhe lnsLalled modules as well as empLy sloLs ln Lhe CompacLuAC chassls.
7. 8lghL-cllck on nl cuAC-9172 and cllck on Self-1esL.

8. 1he devlce passes Lhe self LesL, whlch means lL has lnlLlallzed properly and ls ready Lo be used ln your LabvlLW
appllcaLlon.
rogram LabVILW App||cat|on
9. CreaLe a new vl from Lhe ro[ecL Lxplorer. 8lghL cllck on Lhe Lxerclses folder and selecL New VI. Cnce opened, Save
Lhe vl ln Lhe Lxerclse folder under Lhe name 3-8aslc MeasuremenL.vl."
10. ress <CLrl +1> Lo Llle fronL panel and block dlagram wlndows.
11. ull up Lhe luncLlons aleLLe by rlghL-cllcklng on Lhe whlLe space on Lhe LabvlLW block dlagram wlndow.
12. Move your mouse over Lhe Lxpress Input paleLLe, and cllck Lhe uAC AsslsLanL Lxpress vl. LefL-cllck on Lhe empLy
space Lo place lL on Lhe block dlagram.

13. 1he CreaLe new Lxpress 1ask. wlndow Lhen appears:

14. 1o conflgure a LemperaLure measuremenL appllcaLlon wlLh a Lhermocouple, cllck on Acqu|re S|gna|s Ana|og Input
1emperature 1hermocoup|e. Cllck Lhe + slgn nexL Lo Lhe cuAC1Mod1 (nl 9211), hlghllghL channel al0, and cllck llnlsh.
1hls adds a physlcal channel Lo your measuremenL Lask.
13. Change Lhe C!C Source Lo 8ullL ln and AcqulslLlon Mode Lo ConLlnuous Samples. Cllck Lhe 8un buLLon. ?ou wlll see
Lhe LemperaLure readlngs from Lhe Lhermocouple ln LesL panel wlndow.

16. Cllck SLop and Lhen cllck Ck Lo close Lhe Lxpress block conflguraLlon wlndow Lo reLurn Lo Lhe LabvlLW block
dlagram.
17. LabvlLW auLomaLlcally creaLes Lhe code for Lhls measuremenL Lask. Cllck ?es Lo auLomaLlcally creaLe a Whlle Loop.

18. 8lghL-cllck Lhe daLa Lermlnal ouLpuL on Lhe rlghL slde of Lhe uAC AsslsLanL Lxpress vl and selecL Create Graph
lndlcaLor. 8ename Waveform Craph" Lo 1emperaLure.

19. noLlce LhaL a graph lndlcaLor ls placed on Lhe fronL panel.
20. ?our block dlagram should now look llke Lhe flgure below. 1he whlle loop auLomaLlcally adds a sLop buLLon Lo your
fronL panel LhaL allows you Lo sLop Lhe execuLlon of Lhe loop.

Add|t|ona| Steps (May want to cons|der chang|ng these from "Add|t|on Steps" to "ne|pfu| 1|p" s|nce the user |sn't
necessar||y tak|ng any act|on. If you do e|ect to change |t you may want to not use a numbered ||st
Lxpress vls make creaLlng baslc appllcaLlons very easy. 1helr conflguraLlon dlalogs allow you Lo seL parameLer and
cusLomlze lnpuLs and ouLpuLs based on your appllcaLlon requlremenLs. Powever, Lo opLlmlze your uAC appllcaLlon's
performance and allow for greaLer conLrol you should use sLandard uACmx drlver vls. 8lghL Cllck on block dlagram
luncLlons MeasuremenL l/C aleLLe nl-uACmx.
20. 8efore you generaLe uACmx code you need Lo remove all Lhe code LhaL was auLomaLlcally creaLed by Lhe Lxpress
vl. 8lghL cllck on Lhe whlle loop and selecL 8emove Whlle Loop." 1hen cllck on Lhe SLop buLLon conLrol, and press Lhe
ueleLe key Lo remove Lhe SLop buLLon. 8epeaL acLlons for 1emperaLure Craph as well as any addlLlonal wlres LhaL may
remaln. ?ou can press <ConLrol + 8> Lo remove all unconnecLed wlres from a block dlagram.
21. ConverL Lxpress vl code Lo sLandard vls. Whlle noL all Lxpress vls can be auLomaLlcally converLed Lo sLandard vls,
Lhe uAC AsslsLanL can. 1hls wlll allow for greaLer appllcaLlon conLrol and cusLomlzaLlon. 8lghL-cllck on Lhe uAC
AsslsLanL Lxpress vl you creaLed ln Lhls exerclse and selecL CeneraLe nl-uACmx Code."

?our block dlagram should now appear someLhlng llke Lhls:

1he Lxpress vl has been replaced by Lwo vls. We'll examlne Lhelr funcLlonallLy ln Lhe followlng sLeps.
22. Cpen ConLexL Pelp by cllcklng on Lhe ConLexL Pelp lcon on Lhe upper rlghL corner of Lhe block dlagram. Pover your
cursor over each vl and examlne Lhelr descrlpLlons and wlrlng dlagram.
23. uACmx 8ead.vl reads daLa based on Lhe parameLers lL recelves from Lhe currenLly unLlLled vl on Lhe far lefL.
24. uouble-cllck on Lhe unLlLled vl and open LhaL vl's block dlagram (code shown below).

All Lhe parameLers LhaL are wlred as lnpuLs Lo Lhe dlfferenL uACmx seLup vls reflecL Lhe seLLlng you orlglnally conflgured
ln Lhe uAC AsslsLanL Lxpress vl.
Note: 8y mov|ng these parameter and setup VIs onto the b|ock d|agram, you can now programmat|ca||y change the|r
va|ues w|thout hav|ng to stop your app||cat|on and open the Lxpress VI conf|gurat|on d|a|og, sav|ng deve|opment t|me
and poss|b|y opt|m|z|ng performance by e||m|nat|ng unnecessary sett|ngs depend|ng on you app||cat|on.
Us|ng the LabVILW Lxamp|e I|nder
1he LabvlLW Lxample llnder provldes hundreds of example appllcaLlon Lo use as reference or as Lhe sLarLlng polnL for
your appllcaLlon.
23. Cpen Lhe LabvlLW Lxample llnder Lo flnd uAC examples LhaL use uACmx sLandard vls. Co Lo ne|p I|nd
Lxamp|es. Lo launch Lhe LabvlLW Lxample llnder.
26. 8rowse Lo Lhe uACmx Analog MeasuremenLs folder from Lhe 8rowse Lab aL nardware Input and Cutput DAmx
Ana|og Measurements.

27. 1he followlng vl wlll Lhen appear:


28. SeL Lhe hyslcal Channel Lo maLch Lhe CompacLuAC chassls channel and run Lhe appllcaLlon. Lxpand Lhe physlcal
channel conLrol from Lhe lronL anel and selecL cuAC1Mod1/al0.

ress Lhe 8un buLLon several Llmes whlle holdlng and releaslng Lhe Lhermocouple on Lhe CompacLuAC chassls and
observe Lhe value change on Lhe fronL panel.
29. Cpen Lhe block dlagram and examlne Lhe code. 1hls vl only uses sLandard vls lnsLead of Lxpress vls, whlch allows
much more cusLomlzaLlon of lnpuLs and run-Llme conflguraLlon. Acq 1hermocouple Sample.vl has no whlle loop Lo allow
for conLlnuous execuLlon, and Lhe remalnlng sLeps of Lhls exerclse wlll focus on addlng LhaL funcLlonallLy.
30. Add a whlle loop and SLop buLLon Lo Acq 1hermocouple Sample.vl. 8lghL-cllck on Lhe block dlagram Lo brlng up Lhe
luncLlons paleLLe. llnd Lhe Whlle Loop on Lhe rogrammlng SLrucLures paleLLe and drag a whlle loop over Lhe uACmx
8ead.vl. ?ou may need Lo spread Lhe vls across Lhe block dlagram so LhaL Lhere ls room. ?ou can creaLe addlLlonal
space by holdlng Lhe ConLrol key and dragglng a box on Lhe block dlagram or fronL panel.

8lghL cllck on Lhe Whlle Loop's CondlLlonal Lermlnal and selecL CreaLe ConLrol." 1hls auLomaLlcally wlres a SLop buLLon
Lo Lhe Lermlnal.

noLlce LhaL Lhe SLop buLLon has appeared on Lhe fronL panel.
31. 8un Lhe vl. Acq 1hermocouple Sample.vl now runs conLlnuously.
32. Save Lhe cusLomlzed example vl Lo Lhe ro[ecL. Co Lo I||e Save As., selecL Copy Subst|tute Copy for Cr|g|na| and
name Lhe vl 1hermocouple CusLomlzed Lxample.vl." Save Lhls vl ln Lhe xxxxxxxxx folder. 1hls allows for furLher
developmenL wlLhouL overwrlLlng Lhe LabvlLW example.
Lnd of Lxerc|se




Exercise 4: Add Analysis and Digital Output to the DAQ Application
Set up nardware
1. Conflrm LhaL Lhe CompacLuAC chassls ls powered on and connecLed Lo Lhe C vla Lhe uS8 cable. lf noL, or lf lL ls noL
behavlng as expecLed, repeaL sLeps #1-8 from Lxerclse #3 (pgs. xx-xx).
LabVILW App||cat|on - Compare s|gna| to user-def|ned a|arm
2. Lxerclse 4 ls funcLlonally Lhe same as Lhe end resulL of Lxerclse 3. ?ou can open Lxerclse 4 Lo synchronlze wlLh Lhe
lllusLraLlons ln Lhls secLlon.. Cpen 4-Analysls and CuLpuL.vl from Lhe Lxerclses folder ln Lhe ro[ecL explorer. 1he vl wlll
appear llke Lhe lmage below, wlLh addlLlonal space on Lhe block dlagram Lo add funcLlonallLy:

3. CreaLe an alarm LhaL slgnals lf acqulred LemperaLure goes above a user-deflned level. Cn Lhe fronL panel, rlghL-cllck
Lo open Lhe ConLrols paleLLe rogrammlng numerlc and place a numerlc conLrol on Lhe fronL panel.

4. Change Lhe numerlc conLrol's name Lo "Alarm Level." uouble-cllck on Lhe conLrol's label and replace Lhe generlc LexL
wlLh "Alarm Level"
6. use Lhe Comparlson Lxpress vl Lo compare Lhe acqulred LemperaLure slgnal wlLh Lhe Alarm Level conLrol. SwlLch Lo
Lhe block dlagram, rlghL-cllck on an empLy space and open Lhe luncLlons paleLLe. lace Lhe Comparlson Lxpress vl on
Lhe block dlagram from luncLlons Lxpress ArlLhmeLlc & Comparlson Comparlson.

7. Cnce placed on Lhe block dlagram, Lhe Comparlson Lxpress vl's conflguraLlon dlalog wlll appear.

SelecL "> CreaLer" ln Lhe Compare CondlLlon secLlon and "Second slgnal lnpuL" from Lhe Comparlson lnpuLs secLlon Lhen
cllck Ck.
8. ConnecL Lhe acqulred LemperaLure daLa and Alarm Level lnpuLs Lo Lhe Comparlson Lxpress vl. Pover over Lhe ouLpuL
of Lhe uAC AsslsLanL unLll Lhe spool lcon appears on your cursor, Lhen lefL-cllck and drag you mouse Lo Lhe Cperand 1
lnpuL on Lhe Comparlson Lxpress vl. erform Lhe same hover, drag and connecL Lo wlre Lhe Alarm Level conLrol and Lhe
Cperand 2 lnpuL on Lhe Comparlson Lxpress vl. ?our block dlagram should now look llke Lhls:

9. ulsplay Lhe resulL of Lhe Comparlson Lxpress vl on Lhe fronL panel. Cn Lhe fronL panel, rlghL cllck, open Lhe ConLrols
paleLLe and add a Square LLu lndlcaLor. 1he square LLu ls found aL Contro|s Modern 8oo|ean. 8eslze Lhe Square LLu
so LhaL lL ls easler Lo see and rename lL "Alarm." ?our fronL panel should look llke Lhls:

Cn Lhe block dlagram, wlre Lhe ouLpuL of Lhe Comparlson Lxpress vl Lo Lhe lnpuL of Lhe Alarm lndlcaLor's Lermlnal.

10. 8un Lhe appllcaLlon. ress Lhe 8un buLLon and Lhen change Lhe Alarm Level conLrol Lo some level above Lhe currenL
acqulred LemperaLure slgnal. Pold Lhe Lhermocouple unLll Lhe LemperaLure exceeds Lhe Alarm Level value. 1he Alarm
LLu Lurns on when Lhe acqulred LemperaLure slgnal goes above Lhe level seL on Lhe fronL panel.
Cutput A|arm to CompactDA Chass|s
11. use anoLher uAC AsslsLanL Lxpress vl Lo ouLpuL Alarm's sLaLus Lo Lhe CompacLuAC's 9472 module. Cpen Lhe
luncLlons paleLLe on Lhe block dlagram and flnd Lhe uAC AsslsLanL Lxpress vl aL luncLlons Lxpress CuLpuL.

<plcLure of paleLLe w/ uA clrcled>
12. SelecL CeneraLe Slgnals ulglLal CuLpuL Llne CuLpuL from Lhe CreaLe new Lxpress 1ask. wlndow.

13. SelecL Lhe physlcal channel you wanL Lo use as ouLpuL. Lxpand Lhe + slgn nexL Lo cuAC1Mod4 ln Lhe followlng
wlndow and selecL porL0/llne0.

14. ress Ck ln Lhe uAC AsslsLanL wlndow LhaL appears, slnce all of lLs seLLlngs are correcL for Lhe appllcaLlon.
13. CreaLe an addlLlonal wlre LhaL connecLs Lhe Comparlson Lxpress vl's 8esulL ouLpuL Lo Lhe data lnpuL on Lhe new
uAC AsslsLanL Lxpress vl. A ConverL from uynamlc uaLa funcLlon appears auLomaLlcally. LabvlLW wlll always Lry Lo
coerce unllke daLa Lypes when Lwo nodes are wlred LogeLher. ln Lhls case, Lhe ouLpuL of Lhe Compare Lxpress vl ls a
uynamlc uaLa Lype, and Lhe lnpuL of Lhe uAC AsslsLanL ls 8oolean. LabvlLW placed Lhe ConverL from uynamlc uaLa
node ln beLween Lhe Lwo nodes so Lhey could be connecLed. ?ou can double-cllck Lhe ConverL from uynamlc uaLa Lo
vlew lLs conflguraLlon. ?our block dlagram should now look llke Lhls:

16. 8un Lhe vl. ress Lhe 8un buLLon. noLlce LhaL Lhe LLu bank on Lhe CompacLuAC 9472 module Lurns on and off Lo
maLch Alarm's value on Lhe fronL panel.
17. Save and close Lhe vl.
Lnd of Lxerc|se



Exercise 5: Writing Data to File with LabVIEW
1. ln Lhe Lxerclse folder ln Lhe ro[ecL Lxplorer, open 4-Analysls and CuLpuL.vl. We wlll use Lhe flnal program from Lhe
lasL exerclse as Lhe beglnnlng of Lhls exerclse.
2. 8lghL-cllck on Lhe block dlagram and selecL Iunct|ons Lxpress Cutput Wr|te to Measurement I||e and place lL
lnslde Lhe Whlle Loop on Lhe block dlagram.

3. A conflguraLlon wlndow wlll appear. Conflgure Lhe wlndow as shown below and cllck Ck.

Steve Karcher 7/18/08 6:41 PM
Deleted: .
4. Wlre Lhe ouLpuL of Lhe uAC AsslsLanL Lxpress vl Lo Lhe lnpuL of Lhe WrlLe Lo MeasuremenL llle Lxpress vl.
3. ?our block dlagram should now resemble Lhe followlng flgure.

6. Save Lhe vl ln Lhe xxxxxxx folder by uslng Lhe I||e Save As. menu, selecL Lhe Copy Cpen Add|t|ona| Copy and
name lL 3-WrlLe Lo llle.vl.
7. 8un Lhe vl momenLarlly and press S1C Lo sLop Lhe vl.
8. ?our flle wlll be creaLed ln Lhe folder speclfled.
9. Cpen Lhe flle uslng MlcrosofL Cfflce Lxcel or noLepad. 8evlew Lhe header and LemperaLure daLa saved ln Lhe flle.
10. Close Lhe daLa flle and Lhe LabvlLW vl.
Lnd of Lxerc|se

Potrebbero piacerti anche