版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026西安市胸科醫(yī)院招聘腎內科醫(yī)師筆試參考題庫及答案解析
- 2026年國潮風中的春節(jié)奇遇
- 2026年掌握建筑市場的動態(tài)政策與市場趨勢
- 2026上半年海南事業(yè)單位聯(lián)考三亞市營商環(huán)境建設局下屬事業(yè)單位招聘工作人員4人第1號筆試模擬試題及答案解析
- 2025年九江人事考試及答案
- 2025年北票醫(yī)療系統(tǒng)事業(yè)編報名考試及答案
- 2025年體育老師選調考試筆試及答案
- 2026年歡樂元旦與愛同行
- 2025年蔚來顧問校招筆試及答案
- 2025年普洱市人事考試及答案
- 醫(yī)院網(wǎng)絡安全保障方案與實施步驟
- 我們一起迎戰(zhàn)中考初三家長會課件
- 蘇少版(五線譜)(2024)八年級上冊音樂全冊教案
- 江蘇省城鎮(zhèn)供水管道清洗工程估價表及工程量計算標準 2025
- 2025年國家能源局公務員面試備考指南及模擬題集
- 醫(yī)院感控人員理論知識考核試題及答案
- 2025遼寧鐵道職業(yè)技術學院單招考試文化素質數(shù)學練習題及參考答案詳解(完整版)
- 珍愛健康-遠離油脂課件
- 軍隊自行采購管理辦法
- 核心機房和立體化指揮中心升級改造項目實施方案
- 脊柱內鏡手術機器人系統(tǒng)設計與精準位置控制研究
評論
0/150
提交評論