Exercise 0 - Open and Run a Virtual Instrument 練習0-打開并運行虛擬儀器_第1頁
Exercise 0 - Open and Run a Virtual Instrument 練習0-打開并運行虛擬儀器_第2頁
Exercise 0 - Open and Run a Virtual Instrument 練習0-打開并運行虛擬儀器_第3頁
Exercise 0 - Open and Run a Virtual Instrument 練習0-打開并運行虛擬儀器_第4頁
Exercise 0 - Open and Run a Virtual Instrument 練習0-打開并運行虛擬儀器_第5頁
已閱讀5頁,還剩12頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

Exercise0-OpenandRunaVirtualInstrument(Slide12)ExaminetheSignalGenerationandProcessingVIandrunit.Changethefrequenciesandtypesoftheinputsignalsandnoticehowthedisplayonthegraphchanges.ChangetheSignalProcessingWindowandFilteroptions.AfteryouhaveexaminedtheVIandthedifferentoptionsyoucanchange,stoptheVIbypressingtheStopbutton.1.SelectStart?Programs?NationalInstruments?LabVIEW7.0?LabVIEWtolaunchLabVIEW.TheLabVIEWdialogboxappears.2.SelectHelp?FindExamples.ThedialogboxthatappearslistsandlinkstoallavailableLabVIEWexampleVIs.3.OntheBrowseTab,selectbrowseaccordingtotask.ChooseAnalyzingandProcessingSignals,thenSignalProcessing,thenSignalGenerationandProcessing.vi.ThiswillopentheSignalGenerationandProcessingVIFrontPanel.NoteYoualsocanopentheVIbyclickingtheOpenVIbuttonandnavigatingtolabview\examples\apps\demos.llb\SignalGenerationandProcessing.vi.FrontPanel 4.ClicktheRunbuttononthetoolbar,shownatleft,torunthisVI.ThisVIdeterminestheresultoffilteringandwindowingageneratedsignal.Thisexamplealsodisplaysthepowerspectrumforthegeneratedsignal.Theresultingsignalsaredisplayedinthegraphsonthefrontpanel,asshowninthefollowingfigure.5.UsetheOperatingtool,shownatleft,tochangetheInputSignalandtheSignalProcessing,usetheincrementordecrementarrowsonthecontrol,anddragthepointertothedesiredFrequency.6.PresstheMoreInfo…buttonor[F5]toreadmoreabouttheanalysisfunctions.7.PresstheStopbuttonor[F4]tostoptheVI.BlockDiagram8.SelectWindow?ShowDiagramorpressthe<Ctrl-E>keystodisplaytheblockdiagramfortheSignalGenerationandProcessingVI.(MacOS)Pressthe<Command-E>keys.(Sun)Pressthe<Meta-E>keys.(Linux)Pressthe<Alt-E>keys.Thisblockdiagramcontainsseveralofthebasicblockdiagramelements,includingsubVIs,functions,andstructures,whichyouwilllearnaboutlaterinthiscourse.9.SelectWindow?ShowPanelorpressthe<Ctrl-E>keystoreturntotheFrontPanel.10.ClosetheVIanddonotsavechanges.EndofExercise

Exercise1–ConvertCtoFBuildaVICompletethefollowingstepstocreateaVIthattakesanumberrepresentingdegreesCelsiusandconvertsittoanumberrepresentingdegreesFahrenheit.Inwiringillustrations,thearrowattheendofthismouseiconshowswheretoclickandthenumberonthearrowindicateshowmanytimestoclick.FrontPanelSelectFile?Newtoopenanewfrontpanel.(Optional)SelectWindow?TileLeftandRighttodisplaythefrontpanelandblockdiagramsidebyside.Createanumericdigitalcontrol.YouwillusethiscontroltoenterthevaluefordegreesCentigrade.SelectthedigitalcontrolontheControls?NumericControlspalette.IftheControlspaletteisnotvisible,right-clickanopenareaonthefrontpaneltodisplayit.Movethecontroltothefrontpanelandclicktoplacethecontrol.TypedegCinsidethelabelandclickoutsidethelabelorclicktheEnterbuttononthetoolbar.Ifyoudonottypethenameimmediately,LabVIEWusesadefaultlabel.YoucaneditalabelatanytimebyusingtheLabelingtool.Createanumericdigitalindicator.YouwillusethisindicatortodisplaythevaluefordegreesFahrenheit.SelectthedigitalindicatorontheControls?NumericIndicatorspalette.Movetheindicatortothefrontpanelandclicktoplacetheindicator.TypedegFinsidethelabelandclickoutsidethelabelorclicktheEnterbutton.LabVIEWcreatescorrespondingcontrolandindicatorterminalsontheblockdiagram.Theterminalsrepresentthedatatypeofthecontrolorindicator.Forexample,aDBLterminalrepresentsadouble-precision,floating-pointnumericcontrolorindicator.NoteControlterminalshaveathickerborderthanindicatorterminals.BlockDiagramDisplaytheblockdiagrambyclickingitorbyselectingWindow?ShowDiagram.Note:BlockDiagramterminalscanbeviewedasiconsorasterminals.TochangethewayLabVIEWdisplaystheseobjectsrightclickonaterminalandselectViewAsIcon.SelecttheMultiplyandAddfunctionsontheFunctions?Numericpaletteandplacethemontheblockdiagram.IftheFunctionspaletteisnotvisible,right-clickanopenareaontheblockdiagramtodisplayit.SelectthenumericconstantontheFunctions?Numericpaletteandplacetwoofthemontheblockdiagram.Whenyoufirstplacethenumericconstant,itishighlightedsoyoucantypeavalue.Type1.8inoneconstantand32.0intheother.Ifyoumovedtheconstantsbeforeyoutypedavalue,usetheLabelingtooltoenterthevalues.UsetheWiringtooltowiretheiconsasshowninthepreviousblockdiagram.Towirefromoneterminaltoanother,usetheWiringtooltoclickthefirstterminal,movethetooltothesecondterminal,andclickthesecondterminal,asshowninthefollowingillustration.Youcanstartwiringateitherterminal.Youcanbendawirebyclickingtotackthewiredownandmovingthecursorinaperpendiculardirection.Pressthespacebartotogglethewiredirection.Toidentifyterminalsonthenodes,right-clicktheMultiplyandAddfunctionsandselectVisibleItems?Terminalsfromtheshortcutmenutodisplaytheconnectorpane.Returntotheiconsafterwiringbyright-clickingthefunctionsandselectingVisibleItems?Terminalsfromtheshortcutmenutoremovethecheckmark.WhenyoumovetheWiringtooloveraterminal,theterminalareablinks,indicatingthatclickingwillconnectthewiretothatterminalandatipstripappears,listingthenameoftheterminal.Tocancelawireyoustarted,pressthe<Esc>key,right-click,orclickthesourceterminal.DisplaythefrontpanelbyclickingitorbyselectingWindow?ShowPanel.SavetheVIbecauseyouwillusethisVIlaterinthecourse.SelectFile?Save.Navigatetoc:\exercises\LVIntro.NoteSavealltheVIsyoueditinthiscourseinc:\exercises\LVIntro.TypeConvertCtoF.viinthedialogbox.ClicktheSavebutton.EnteranumberinthedigitalcontrolandruntheVI.UsetheOperatingtoolortheLabelingtooltodouble-clickthedigitalcontrolandtypeanewnumber.ClicktheRunbuttontoruntheVI.TryseveraldifferentnumbersandruntheVIagain.SelectFile?ClosetoclosetheConvertCtoFVI.EndofExercise

Exercise2a–CreateaSubVIFrontPanelSelectFile?Openandnavigatetoc:\exercises\LVIntrotoopentheConvertCtoFVI.IfyouclosedallopenVIs,clicktheOpen…buttonontheLabVIEWdialogbox.TipClickthearrownexttoOpen…buttonontheLabVIEWdialogboxtoopenrecentlyopenedfiles,suchasConvertCtoF.vi.Thefollowingfrontpanelappears.Right-clicktheiconintheupperrightcornerofthefrontpanelandselectEditIconfromtheshortcutmenu.TheIconEditordialogboxappears.Double-clicktheSelecttoolontheleftsideoftheIconEditordialogboxtoselectthedefaulticon.Pressthe<Delete>keytoremovethedefaulticon.Double-clicktheRectangletooltoredrawtheborder.Createthefollowingicon.UsetheTexttooltoclicktheeditingarea.TypeCandF.Double-clicktheTexttoolandchangethefonttoSmallFonts.UsethePenciltooltocreatethearrow.NoteTodrawhorizontalorverticalstraightlines,pressthe<Shift>keywhileyouusethePenciltooltodragthecursor.UsetheSelecttoolandthearrowkeystomovethetextandarrowyoucreated.SelecttheB&Wiconandselect256ColorsintheCopyfromfieldtocreateablackandwhiteicon,whichLabVIEWusesforprintingunlessyouhaveacolorprinter.Whentheiconiscomplete,clicktheOKbuttontoclosetheIconEditordialogbox.Theiconappearsintheupperrightcornerofthefrontpanelandblockdiagram.Right-clicktheicononthefrontpanelandselectShowConnectorfromtheshortcutmenutodefinetheconnectorpaneterminalpattern.LabVIEWselectsaconnectorpanepatternbasedonthenumberofcontrolsandindicatorsonthefrontpanel.Forexample,thisfrontpanelhastwoterminals,degCanddegF,soLabVIEWselectsaconnectorpanepatternwithtwoterminals.Assigntheterminalstothedigitalcontrolanddigitalindicator.SelectHelp?ShowContextHelptodisplaytheContextHelpwindow.VieweachconnectionintheContextHelpwindowasyoumakeit.Clicktheleftterminalintheconnectorpane.ThetoolautomaticallychangestotheWiringtool,andtheterminalturnsblack.ClickthedegCcontrol.Theleftterminalturnsorange,andamarqueehighlightsthecontrol.Clickanopenareaofthefrontpanel.Themarqueedisappears,andtheterminalchangestothedatatypecolorofthecontroltoindicatethatyouconnectedtheterminal.ClicktherightterminalintheconnectorpaneandclickthedegFindicator.Therightterminalturnsorange.Clickanopenareaonthefrontpanel.Bothterminalsareorange.Movethecursorovertheconnectorpane.TheContextHelpwindowshowsthatbothterminalsareconnectedtofloating-pointvalues.SelectFile?SavetosavetheVIbecauseyouwillusethisVIlaterinthecourse.SelectFile?ClosetoclosetheConvertCtoFVI.EndofExercise

Exercise2b-DataAcquisitionTocompletethisexercise,youwillneedtheICtemperaturesensoravailableoneithertheBNC-2120,SCB-68,orDAQSignalAccessory.FrontPanelSelectFile?Newtoopenanewfrontpanel.Createthethermometerindicator,asshownonthefollowingfrontpanel.SelectthethermometerontheControls?NumericIndicatorspaletteandplaceitonthefrontpanel.TypeTemperatureinsidethelabelandclickoutsidethelabelorclicktheEnterbuttononthetoolbar.Right-clickthethermometerandselectVisibleItems?DigitalDisplayfromtheshortcutmenutodisplaythedigitaldisplayforthethermometer.Createtheverticalswitchcontrol.SelecttheverticaltoggleswitchontheControls?Buttonspalette.TypeTempScaleinsidethelabelandclickoutsidethelabelorclicktheEnterbutton.UsetheLabelingtooltoplaceafreelabel,degC,nexttotheTRUEpositionoftheswitch,asshowninthepreviousfrontpanel.Placeafreelabel,degF,nexttotheFALSEpositionoftheswitch.BlockDiagramSelectWindow?ShowDiagramtodisplaytheblockdiagram.Buildthefollowingblockdiagram.PlacetheDAQAssistantExpressVIlocatedontheFunctions?Inputpalette.MakethefollowingconfigurationsintheDAQAssistantconfigurationwizard.SelectAnalogInputasthemeasurementtype.SelectVoltage.Selectai0asthechannelfromyourdataacquisitiondevice.IntheTaskTimingsection,selectAcquire1sample.PlacetheConvertfromDynamicDatafunctionlocatedontheFunctions?SignalManipulationandselectSingleScalarastheResultingdatatype.PlacetheMultiplyfunctionlocatedontheFunctions?Numericpalette.ThisfunctionmultipliesthevoltagethattheAISampleChannelVIreturnsby100.0toobtaintheCelsiustemperature.SelectFunctions?SelectaVI,navigatetotheConvertCtoFVI,whichyoubuiltinExercise2a,andplacetheVIontheblockdiagram.ThisVIconvertstheCelsiusreadingstoFahrenheit.PlacetheSelectfunctionlocatedontheFunctions?Comparisonpalette.ThisfunctionreturnseithertheFahrenheit(FALSE)orCelsius(TRUE)temperaturevalue,dependingonthevalueofTempScale.Right-clicktheyterminaloftheMultiplyfunction,selectCreate?Constant,type100,andpressthe<Enter>keytocreateanothernumericconstant.UsethePositioningtooltoplacetheiconsasshowninthepreviousblockdiagramandusetheWiringtooltowirethemtogether.TipToidentifyterminalsonthenodes,right-clicktheiconandselectVisibleItems?Terminalfromtheshortcutmenutodisplaytheconnectorpane.DisplaythefrontpanelbyclickingitorbyselectingWindow?ShowPanel.ClicktheContinuousRunbutton,shownatleft,toruntheVIcontinuously.Putyourfingeronthetemperaturesensorandnoticethetemperatureincrease.ClicktheContinuousRunbuttonagaintostoptheVI.Createthefollowingicon,soyoucanusetheTemperatureVIasasubVI.Right-clicktheiconintheupperrightcornerofthefrontpanelandselectEditIconfromtheshortcutmenu.TheIconEditordialogboxappears.Double-clicktheSelecttoolontheleftsideoftheIconEditordialogboxtoselectthedefaulticon.Pressthe<Delete>keytoremovethedefaulticon.Double-clicktheRectangletooltoredrawtheborder.UsethePenciltooltodrawaniconthatrepresentsthethermometer.UsetheForegroundandFilltoolstocolorthethermometerred.NoteTodrawhorizontalorverticalstraightlines,pressthe<Shift>keywhileyouusethePenciltooltodragthecursor.Double-clicktheTexttool,shownatleft,andchangethefonttoSmallFonts.SelecttheB&Wiconandselect256ColorsintheCopyfromfieldtocreateablackandwhiteicon,whichLabVIEWusesforprintingunlessyouhaveacolorprinter.Whentheiconiscomplete,clicktheOKbutton.Theiconappearsintheupperrightcornerofthefrontpanel.SelectFile?SavetosavetheVI.ChoosealocationonyourharddriveandsavetheVIasThermometer.vi.SelectFile?ClosetoclosetheVI.EndofExercise

Exercise3–UsingLoopsUseawhileloopandawaveformcharttobuildaVIthatdemonstratessoftwaretiming.FrontPanelOpenanewVI.Buildthefollowingfrontpanel.SelectthehorizontalpointerslideontheControls?NumericControlspaletteandplaceitonthefrontpanel.Youwillusetheslidetochangethesoftwaretiming.TypemilliseconddelayinsidethelabelandclickoutsidethelabelorclicktheEnterbuttononthetoolbar,shownatleft.PlaceaStopButtonfromtheControls?Buttonspalette.SelectawaveformchartontheControls?GraphIndicatorspaletteandplaceitonthefrontpanel.Thewaveformchartwilldisplaythedatainrealtime.TypeValueHistoryinsidethelabelandclickoutsidethelabelorclicktheEnterbutton.ThewaveformchartlegendlabelstheplotPlot0.UsetheLabelingtooltotriple-clickPlot0inthechartlegend,typeValue,andclickoutsidethelabelorclicktheEnterbuttontorelabelthelegend.Therandomnumbergeneratorgeneratesnumbersbetween0and1,inaclassroomsettingyoucouldreplacethiswithadataacquisitionVI.UsetheLabelingtooltodouble-click10.0inthey-axis,type1,andclickoutsidethelabelorclicktheEnterbuttontorescalethechart.Change–10.0inthey-axisto0.Labelthey-axisValueandthex-axisTime(sec).BlockDiagramSelectWindow?ShowDiagramtodisplaytheblockdiagram.EnclosethetwoterminalsinaWhileLoop,asshowninthefollowingblockdiagram.SelecttheWhileLoopontheFunctions?ExecutionControlpalette.Clickanddragaselectionrectanglearoundthetwoterminals.UsethePositioningtooltoresizetheloop,ifnecessary.SelecttheRandomNumber(0-1)ontheFunctions?ArithmeticandComparison?Numericpalette.AlternativelyyoucoulduseaVIthatisgatheringdatafromanexternalsensor.Wiretheblockdiagramobjectsasshowninthepreviousblockdiagram.SavetheVIasUseaLoop.vibecauseyouwillusethisVIlaterinthecourse.DisplaythefrontpanelbyclickingitorbyselectingWindow?ShowPanel.RuntheVI.ThesectionoftheblockdiagramwithintheWhileLoopborderexecutesuntilthespecifiedconditionisTRUE.Forexample,whiletheSTOPbuttonisnotpressed,theVIreturnsanewnumberanddisplaysitonthewaveformchart.ClicktheSTOPbuttontostoptheacquisition.TheconditionisFALSE,andtheloopstopsexecuting.FormatandcustomizetheXandYscalesofthewaveformchart.Right-clickthechartandselectPropertiesfromtheshortcutmenu.Thefollowingdialogboxappears.ClicktheScaletabandselectdifferentstylesforthey-axis.Youalsocanselectdifferentmappingmodes,gridoptions,scalingfactors,andformatsandprecisions.NoticethatthesewillupdateinteractivelyonthewaveformchartSelecttheoptionsyoudesireandclicktheOKbutton.Right-clickthewaveformchartandselectDataOperations?ClearChartfromtheshortcutmenutoclearthedisplaybufferandresetthewaveformchart.IftheVIisrunning,youcanselectClearChartfromtheshortcutmenu.AddingTimingWhenthisVIruns,theWhileLoopexecutesasquicklyaspossible.Completethefollowingstepstotakedataatcertainintervals,suchasonceeveryhalf-second,asshowninthefollowingblockdiagram.PlacetheTimeDelayExpressVIlocatedontheFunctions?ExecutionControlpalette.Inthedialogboxthatappears,insert0.5.Thisfunctionwouldmakesurethateachiterationoccurseveryhalf-second(500ms).Dividethemilliseconddelayby1000togettimeinseconds.ConnecttheoutputofthedividefunctiontotheDelayTime(s)inputoftheTimeDelayExpressVI.Thiswillallowyoutoadjustthespeedoftheexecutionfromthepointerslideonthefrontpanel.SavetheVI,becauseyouwillusethisVIlaterinthecourse.RuntheVI.TrydifferentvaluesforthemilliseconddelayandruntheVIagain.Noticehowthiseffectsthespeedofthenumbergenerationanddisplay.ClosetheVI.EndofExercise

Exercise4-AnalyzingandLoggingDataCompletethefollowingstepstobuildaVIthatmeasurestemperatureevery0.25sfor10s.Duringtheacquisition,theVIdisplaysthemeasurementsinrealtimeonawaveformchart.Aftertheacquisitioniscomplete,theVIplotsthedataonagraphandcalculatestheminimum,maximum,andaveragetemperatures.TheVIdisplaysthebestfitofthetemperaturegraph.FrontPanelOpenanewVIandbuildthefollowi

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論