Professional Documents
Culture Documents
4.SelectVIFromTemplateTutorial(GettingStarted)GenerateandDisplayandclickOK.
8.ClicktheNumericControlspalette,andselectaKnobtobeplacedonthefrontpanel.Todothis,clickthe Knobanddragittothefrontpanel.Clickoncetoplaceit
9.DoubleclickontheknobslabelandchangeittoAmplitude.
10.Repeatsteps79tomakeanotherknobforfrequency.ChangeitslabeltoFrequency.Doubleclickthe maximumvalueonFrequencysscaleandchangeitto50. 4
FrontPanel
BlockDiagram
14.UseContextHelptoidentifyobjectdetailswhileprogramming.PresstheContextHelpbuttonintheupper rightportionoftheblockdiagram.
15.WiththeContextHelpactive,hoveryourcursoroverdifferentobjectsontheblockdiagramandfrontpanel ofyourVI.Asyoudoso,theContextHelpWindowprovidesdetailsincludingdescriptionsandwiringdiagrams.
8.Thedevicepassestheselftest,whichmeansithasinitializedproperlyandisreadytobeusedinyourLabVIEW application.CloseMAX. 7
13.TheCreateNewExpressTaskwindowthenappears:
15.ChangetheCJCSourcetoBuiltInandAcquisitionModetoContinuousSamples.ClicktheRunbutton.Youwill seethetemperaturereadingsfromthethermocoupleintestpanelwindow.
18.RightclickthedataterminaloutputontherightsideoftheDAQAssistantExpressVIandselectCreate GraphIndicator.RenameWaveformGraphtoTemperature.
10
22.Also,rightclickonthestop(F)buttonandselectReplace.TheControlspalettewillappear.Select BooleanStopButton.
11
24.OntheScaletab,changetheMinimumto20andtheMaximumto30.
25.ClickOKwhenyouarefinishedandsavetheVI. ExpressVIsmakecreatingbasicapplicationsveryeasy.Theirconfigurationdialogsallowyoutosetparameter andcustomiseinputsandoutputsbasedonyourapplicationrequirements.However,tooptimizeyourDAQ applicationsperformanceandallowforgreatercontrolyoushouldusestandardDAQmxdriverVIs.RightClick onblockdiagramFunctionsMeasurementI/OPaletteNIDAQmx. 26.BeforeyougenerateDAQmxcodeyouneedtoremoveallthecodethatwasautomaticallycreatedbythe ExpressVI.RightclickonthewhileloopandselectRemoveWhileLoop.ThenclickontheStopbuttoncontrol, andpresstheDeletekeytoremovetheStopbutton.RepeatactionsforTemperatureGraphaswellasany additionalwiresthatmayremain.Youcanpress<Control+B>toremoveallunconnectedwiresfromablock diagram.
12
Yourblockdiagramshouldnowappearsomethinglikethis:
13
AlltheparametersthatarewiredasinputstothedifferentDAQmxsetupVIsreflectthesettingyouoriginally configuredintheDAQAssistantExpressVI. Note:BymovingtheseparametersandsetupVIsontotheblockdiagram,youcannowprogrammatically changetheirvalueswithouthavingtostopyourapplicationandopentheExpressVIconfigurationdialog, savingdevelopmenttimeandpossiblyoptimizingperformancebyeliminatingunnecessarysettingsdepending onyourapplication. UsingtheLabVIEWExampleFinder TheLabVIEWExampleFinderprovideshundredsofexampleapplicationtouseasreferenceorasthestarting pointforyourapplication. 31.OpentheLabVIEWExampleFindertofindDAQexamplesthatuseDAQmxstandardVIs.GotoHelpFind ExamplestolaunchtheLabVIEWExampleFinder.LabVIEWthenindexesalltheexamplesinstalledonthelocal machine. 32.BrowsetotheDAQmxTemperaturefolderfromtheBrowsetabatHardwareInputandOutputDAQmx AnalogMeasurementsTemperature.DoubleClickontheAcqThermocoupleSample.vitoopenit.
14
33.ThefollowingVIwillthenappear:
34.SetthePhysicalChanneltomatchtheCompactDAQchassischannelandruntheapplication.Expandthe physicalchannelcontrolfromtheFrontPanelandselectcDAQ1Mod1/ai0.
37.RightclickontheWhileLoopsConditionalterminalandselectCreateControl.Thisautomaticallywiresa Stopbuttontotheterminal.
16
Exercise 2b: Add Analysis and Digital Output to the DAQ Application
SetupHardware 1.ConfirmthattheCompactDAQchassisispoweredonandconnectedtothePCviatheUSBcable.Ifnot,orifit isnotbehavingasexpected,repeatsteps18fromExercise2a. LabVIEWApplicationComparesignaltouserdefinedalarm 2.Exercise2bisfunctionallythesameastheendresultofExercise2a.YoucanopenExercise2b.vifromthe Exercisesfoldertosynchronisewiththeillustrationsinthissection.TheVIwillappearliketheimagebelow,with additionalspaceontheblockdiagramtoaddfunctionality:
3.Createanalarmthatsignalsifacquiredtemperaturegoesaboveauserdefinedlevel.Onthefrontpanel, rightclicktoopentheControlspaletteExpressNumericandplaceaVerticalPointerSlideonthefrontpanel.
17
5.OntheScaletabmakethefollowingchangestoScaleRangeandclickOKtoapplythechanges. Maximum:30
18
7.Onceplacedontheblockdiagram,theComparisonExpressVI'sconfigurationdialogwillappear.
Select">Greater"intheCompareConditionsectionand"Secondsignalinput"fromtheComparisonInputs sectionthenclickOK.
19
20
10.Ontheblockdiagram,wiretheoutputoftheComparisonExpressVItotheinputoftheAlarmindicator's terminal.
21
13.SelectGenerateSignalsDigitalOutputLineOutputfromtheCreateNewExpressTaskwindow.
14.Selectthephysicalchannelyouwanttouseasoutput.Expandthe+signnexttocDAQ1Mod4inthe followingwindowandselectport0/line0.
15.PressOKintheDAQAssistantwindowthatappears,sinceallofitssettingsarecorrectfortheapplication. 22
23
3.Aconfigurationwindowwillappear.ConfigurethewindowasshownbelowandclickOK.
Note:ClickontheHelpbuttonforamoredetailedexplanationofthesettingsinthisdialogbox. 24
4.WiretheoutputoftheDAQAssistantExpressVItotheinputoftheWritetoMeasurementFileExpressVI. 5.Yourblockdiagramshouldnowresemblethefollowingfigure.
26
4.WiretheResultfromtheCompareExpressVItotheselectorterminalofthecasestructureasshownbelow.
Nowthedatawillonlybeloggedtodiskwhenthealarmisactive.BecausetheFalsecaseisempty,nothingwill happenwhenalarmconditionisnotmet. 5.SavetheVIintheC:\Seminars\DAQHandsOn\ExercisesfolderbyusingtheFileSaveAsmenu,selectthe CopySubstituteCopyforOriginalandnameitExercise3b.vi. 6.RuntheVI.Changethealarmlevelandheatthethermocouplesothatthealarmgoesonandoffafewtimes. PressSTOPtostoptheVI. 7.Yourfilewillbecreatedinthefolderspecified. 8.OpenthefileusingMicrosoftOfficeExcelorNotepad.Reviewtheheaderandtemperaturedatasavedinthe file. 9.Closethedatafile. 27
2.NextSelectthegreaterthanfunctionfromtheComparisonspalette.
28
3.Wireasfollows.
4.RightclickontheopenterminalofthegreaterthanblockandselectCreateConstant.
5.Changetheconstantto10000asshownbelowandSaveandRuntheVI.
29
EndofExercise3b.
30
4.IntheSignalsectionofthewindow,setAmplitudeto5. 5.IntheTimingsectionofthewindow,setSamplespersecond(Hz)to10,000.ClickOK.
6.BringuptheFunctionsExpresspaletteagain,andbrowsetotheDAQAssistantExpressVIontheOutput subpaletteoftheFunctionspalette.PlacetheVIontheblockdiagram. 31
7.IntheCreateNewwindow,selectAnalogueOutputastheMeasurementTypeandthenselectVoltage.
8.Inthenextwindow,clickthe+signnexttocDAQ1Mod3(NI9263),selectao0,andclicktheFinishbutton.
32
33
12.DrawtheWhileLooparoundyourentireblockdiagram.Yourblockdiagramshouldresemblethefollowing figure.
34
14.RightclicktheslidecontrolandselectProperties.OntheAppearancetab,changethelabeltoFrequency.On theScaletab,changetheScaleRangesoMinimumequals0.00andMaximumequals1000.00.ClickOKtoclose thePropertieswindow. 15.Press<CtrlE>toswitchtotheblockdiagram.NoticetheorangeFrequencyslidecontrolterminal.Movethe controlinsidetheWhileLooptotheleftsideoftheSimulateSignalExpressVI.Wiretheknobcontroltothe FrequencyinputterminaloftheSimulateSignalExpressVI(thesecondorangearrowontheleftsideofthe SimulateSignalExpressVI). Note:MakesurethatyouwiretheknobcontroltothecorrectinputterminaloftheSimulateSignalExpressVI.If youmakeabadwireconnection,doubleclickthewiretoselectitandpress<Delete>. Yourblockdiagramshouldresemblethefollowingfigure.
35
20.IntheDAQAssistantwindow,selectContinuousSamplesfromtheTaskTimingtabinthelowerpartofthe window.SettheSamplestowriteandRate(Hz)to10,000andclickOK.
36
21.OnceyouclickOK,adialogwindowwillappearaskingifyouwouldliketocreateaWhileLooparoundthe DAQAssistant.SelectYestoautomaticallycreateaWhileLoopforthiscontinuousacquisition.
37
23.Belowisapictureofthecompletedblockdiagram.
38
26.Rearrangethefrontpanelcontrolsandindicatorstoresemblethefigurebelow.
Trybuildingthefollowingblockdiagramtofurthermanipulatethewaveformbeinggenerated.
EndofExercise4
40