




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 家庭教育服务合同
- 酒店餐厅品牌使用权与管理合同
- 农村金融机构品牌建设方案
- 山东消防施工合同
- 工程设备材料采购合同
- 学校食堂大楼承包施工合同
- 销售苗木合同
- 农户打井合同范本
- (18)-《四大名著》常考知识点
- 剩余土方清运合同范本
- 2025中国建材集团有限公司招聘14人笔试参考题库附带答案详解
- 2024年初级会计实务考试真题及答案(5套)
- 2025年学校食堂防火应急演练工作实施方案
- 2025届广东省高三第一次调研考试语文试题讲评课件
- 2025年4月自考00152组织行为学押题及答案
- 2025【英文合同】授权代理合同英文范本
- 山东省名校联盟2024-2025学年高一3月校际联考英语试题(原卷版+解析版)
- 数据库应用技术-第三次形考作业(第10章~第11章)-国开-参考资料
- 湖南2025届新高考教学教研联盟(长郡二十校)高三第二次预热演练数学试题(含答案)
- 元朝的建立与统一课件 2024-2025学年统编版七年级历史下册
- 8个事故案例13个警示视频文字完善篇(矿山局迎检资料)
评论
0/150
提交评论