Sunteți pe pagina 1din 5

Signal Generation Using NI-DAQmx

WeiLin
DepartmentofBiomedicalEngineering
StonyBrookUniversity

Instructors Portion
Summary
ThisexperimentrequiresthestudenttouseNIDAQmxtogenerate
analogyvoltagesignalsofsinusoidal,triangle,squarewaveanduser
definedwave.StudentsshouldbefamiliarwiththefollowingLabVIEW
programmingtechnique
1. NIDAQmx
2. LabVIEWapplicationforanalogsignalgeneration
3. LabVIEWSimulateSignalexpressVI

Uses
Thislectureappliestoallcoursesofvirtualinstrumentation.

Equipment List

Computers

LabVIEW7Express

NIELVISbenchtopworkstation

LabVIEW Users Manual. April 2003

LabVIEW Introduction Course - Six Hours.

LabVIEW Introduction Course - Three Hours

LectureSlidesofLabVIEWProgramming,PartIV

References

SubmittinganExperiment

Students Portion
Introduction
ThestudentsshouldlearnthebasicLabVIEWprogrammingtechniques
forthesignalgenerationusingNIDAQmx.TheywillcreatetwoVIs,one
forthegenerationofacontinuousfunctionwaveformsuchasasinusoidal
signalandtheotherforthegenerationofarbitrarywaveform.Students
willuseVIsdevelopedintheprojectDataAcquisitionUsingNI
DAQmxtoacquirethesignalsgenerated.

Objectives

NIDAQmx
AnalogsignalgenerationusingNIDAQmx
LabVIEWgraphandchart

Theory
NI-DAQmx is the next generation drivers for the data acquisition hardware
from National Instruments. It is easy to use and has many new features such
as improved ease of use, faster development time, multithreaded
measurements and increased accuracy of measurements. NI-DAQmx can also
be used to generate analog signals if the data acquisition hardware has the
analog output capability. The signal generation application is as
straightforward as the data acquisition application. The following are the steps
for creating such an application.
1. CreateavirtualchannelandtaskusingtheNIDAQmxCreate
VirtualChannelVI.
2. Setthesamplingfrequencyandsamplingmode,usuallythe
continuoussamplesusingNIDAQmxTimingVI.
3. Createthewaveformdatafortheanalogsignalgeneration.
4. SetthetriggerusingNIDAQmxTriggerVI.Thisstepisoptional.
5. StartthesignalgenerationprocessusingNIDAQmxStartVI.
6. ClearthesignalgenerationtaskusingtheNIDAQmxClearVI.
AlltheNIDAQmxVIsarelinkedthroughtaskinandtaskoutterminaland
theerrorclusterchain.

SubmittinganExperiment

Lab Procedure
Experiment1,CreateaLabVIEWsignalgenerationapplicationof
functiongenerator:
1. LaunchLabVIEW.
2. CreateablankVI.
3. Thefrontpanelshouldhavethenumericcontrolsifamplitudeand
frequency.ItshouldalsohavetheNIDAQmxphysicalchannel
controlanderrorclustercontrol.
4. DroptheNIDAQmxCreateVirtualChannelVItotheblock
diagramandchooseAOvoltage.Connectcontrolsphysical
channelanderrorclustertotherespectiveterminals.Connectthe
controlofamplitudetothemaximumvalueterminal.Takethe
negativevalueofamplitudeandconnectittotheminimumvalue
terminal.
5. DroptheSimulateSignalexpressVItotheblockdiagramand
configurethesignaltypeassinewave.Selectthesamplesper
secondas200andthenumberofsamplesas1000.Youcanchange
thenumberofsamplestoothernumberaslongasthewaveformis
incompletecycles.Connecttheamplitudecontroltotheamplitude
terminal.ConvertthedynamicdatatypefromtheSimulate
SignalVItowaveformdatatype.
6. DroptheNIDAQmxtimingVItotheblockdiagramandchoose
UseWaveformwhichwilldeterminethesamplingfrequency
basedontheinputwaveform.Connectwaveformfromthe
SimulatedSignalexpressVItothewaveformterminal.Connect
anumericconstantof10123tothesamplemodeterminal.This
configuresthecontinuousgenerationmood.
7. DroptheNIDAQmxwriteVItotheblockdiagram.Select
analogWfm1ChaNSampandconnectthewaveformdatatothe
terminaldata.
8. DroptheNIDAQmxStartVItotheblockdiagram.
9. CreateawhileloopanddroptheNIDAQmxIsTaskDoneVI
insidetheloop.
10. DroptheNIDAQmxClearVItotheblockdiagramoutsideof
thewhileloop.
11. ConnecttheNIDAQmxVIsthroughtaskinandtaskout
terminalsanderrorclusterinputandoutputterminals.Attheerror
outputofNIDAQmxIsTaskDoneVIextracttheerrorstatus
usingtheunbundledclusterbynamefunction.Theoutputfrom
thisfunctionshouldbeORedwiththesignalfromthestopbottom
insidetheloop.Thiscancontroltheapplicationtostopifanyerror
occursduringthegenerationofthesignal.

SubmittinganExperiment

12. DropaGeneralErrorHandlerVItotheblockdiagramand
connecttheerroroutputoftheNIDAQmxClearVItoit.
13. KeeptheELVISunitoff.Connecttheoutputoffunctiongenerator
DAC0toCHA+andGROUNDtoCHAusing
connectionwiresontheprototypeboard.
14. TurnELVISunitonincludingtheprototypeboard.
15. LaunchELVISapplicationandchooseoscilloscope.
16. SelecttheChannelandsetthetimebaseto200ms.
17. EntertheparametersforthecontrolsoftheLabVIEW.Selectthe
frequencyas1Hzandamplitudelessthan10V.Runthesignal
generationapplication.
18. UsetheELVISscopetoviewthegeneratedsignal.
19. StopthesignalgenerationVIandturnoffthepowerofthe
prototypingboardoftheELVISsystem.ConnectACH0to
DAC0.
20. LaunchyourdataacquisitionVI.RunbothdataacquisitionVIand
signalgenerationVI.Youshouldbeabletocollectthegenerated
signal.
21. UsethefinitesampledataacquisitionVItocollectandsavethe
generatedsignals.
Experiment2,CreateaLabVIEWsignalgenerationapplicationof
continuoussamples:
1. ModifytheLabVIEWcodeofpreviousexperimentbyaddingthe
secondSimulateSignalVI.UsethesecondVItogeneratea
squarewaveandselectthesamplespersecondas200andthe
numberofsamplesas200.
2. CombinethesecondwaveformwiththefirstoneusingAppend
WaveformsVI.Youhavecreatedanewwaveformwithbothsine
waveandsquarewave.
3. Runtheapplicationasdescribedinthepreviousexperiment.

Lab Report
Thelabreportshouldcontainthefollowing:
1.
2.
3.
4.
5.

SubmittinganExperiment

Theexperimenttitle
Theexperimentobjective
Theexperimentprocedureandtheory
Discussion
Youmayaddyourlabdesignintothisproject.

Pleasesubmitthereportthroughemail.

SubmittinganExperiment

S-ar putea să vă placă și