版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 关于合作伙伴年度合作成果的评估函(7篇)
- 学法减分题库带答案
- 初中八年级信息技术教学设计 Arduino声光交互 蜂鸣器与防空报警器项目实践
- 初中八年级英语Sothat句型深度教学设计
- 九年级英语I Used to Be Afraid of the Dark第五课时词汇运用教学设计
- 九年级语文《曹刿论战》深度教学设计:文言思辨与历史现场的双向构建
- 高中生物选择性必修2 第2章 生物与环境核心素养导向的单元整体教学设计
- 初中九年级物理电功与电热单元复习教学设计(苏科版下册)
- 高中政治选择性必修三教学设计:创新思维的含义与特征深度教学实践
- 九年级化学“化学用语”单元整体教学设计
- 2026中国水务处理行业市场分析现状及投资风险评估规划发展研究报告
- 2026纪念长征胜利90周年知识竞赛试题100题(含答案解析)
- 2026年电气工程的伦理与社会责任
- 2026智慧城市低空基础设施建设研究报告(2026.7)
- 电缆敷设工程施工组织设计与风险控制
- 宾馆宽带业务合同
- 2026年入团考试150题题库及答案解析(完整版)
- 2026四川甘孜州泸定县招聘“一村一幼”辅导员8人备考题库及完整答案详解一套
- 装配式构件施工安全技术交底
- GB/T 46576-2025温室气体产品碳足迹量化方法物理回收再生塑料产品
- GB/T 46503-2025家用和类似用途咖啡机
评论
0/150
提交评论