Sei sulla pagina 1di 4

Data Acquisition Using NI-DAQmx

WeiLin
DepartmentofBiomedicalEngineering
StonyBrookUniversity

Instructors Portion
Summary
ThisexperimentrequiresthestudenttouseNIDAQmxtoacquirevoltage
signals.StudentsshouldbefamiliarwiththefollowingLabVIEW
programmingtechnique
1.
2.
3.
4.

NIDAQmx
LabVIEWapplicationfordataacquisition
LabVIEWgraphandchart
LabVIEWwriteLabVIEWmeasurementfileexpressVI

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
forthedataacquisitionusingNIDAQmx.TheywillcreatetwoVIs,one
forfinitesamplesandtheotherforcontinuoussamples.Studentswilluse
graphandchartindicatortodisplayacquiredsignalsonthescreenand
savethedatainfilesforfutureanalysis.

Objectives

NIDAQmx
DataacquisitionprogrammingusingNIDAQmx
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. The data acquisition
application in LabVIEW and NI-DAQmx is quite straightforward. The
following are the steps for creating such an application.
1. CreateavirtualchannelandtaskusingtheNIDAQmxCreate
VirtualChannelVI.
2. Setthesamplingfrequencyandsamplingmode,continuousor
finitesamplesusingNIDAQmxTimingVI.
3. SetthetriggerusingNIDAQmxTriggerVI.Thisstepisoptional.
4. StartthedataacquisitionprocessusingNIDAQmxStartVI.
5. ReadtheacquireddatausingNIDAQmxReadVI.
6. ClearthedataacquisitiontaskusingtheNIDAQmxClearVI.
AlltheNIDAQmxVIsarelinkedthroughtaskinandtaskoutterminaland
theerrorclusterchain.Forcontinuoussamplesmode,theNIDAQmxRead
VIshouldbeplacedwithinawhileloop.

SubmittinganExperiment

Lab Procedure
Experiment1,CreateaLabVIEWdataacquisitionapplicationof
finitesamples:
1. LaunchLabVIEW.
2. CreateablankVI.
3. Thefrontpanelshouldhavethefollowingnumericcontrols:
minimumvalue,maximumvalue,samplefrequencyandnumberof
samples.ItshouldalsohavetheNIDAQmxphysicalchannel
controlanderrorclustercontrol.
4. DroptheNIDAQmxCreateVirtualChannelVItotheblock
diagramandchooseAIvoltage.Connectcontrolsofminimum
value,maximumvalue,physicalchannelanderrorclustertothe
respectiveterminals.Wireanumericalconstant10083tothe
inputterminalconfigurationterminal.Thisconfigurestheinput
asreferencedsingleendedterminal.
5. DroptheNIDAQmxtimingVItotheblockdiagramandchoose
Sampleclock.Connectcontrolsofsamplingfrequencyandthe
numberofsamplestotherespectiveterminal.Connectanumeric
constantof10178tothesamplemodeterminal.Thisconfigures
thefinitesamplemood.
6. DroptheNIDAQmxStartVItotheblockdiagram.
7. DroptheNIDAQmxreadVItotheblockdiagram.Select
analog1DWfmNChaNSampandconnectthecontrolofthe
numberofsamplestotheterminalnumberofsamplesper
channel.
8. DroptheNIDAQmxClearVItotheblockdiagram.
9. Dropawaveformindicatoronthefrontpanel.Connecttheoutput
fromtheterminaldataofNIDAQmxreadVItothewaveform
indicator.
10. ConnecttheNIDAQmxVIsthroughtaskinandtaskout
terminalsanderrorclusterinputandoutputterminals.
11. DropaGeneralErrorHandlerVItotheblockdiagramand
connecttheerroroutputoftheNIDAQmxClearVItoit.
12. DropaWriteLabVIEWMeasurementFileexpressVItothe
blockdiagramandconnecttheacquireddatatoit.
13. KeeptheELVISunitoff.Connecttheoutputoffunctiongenerator
FUNCOUTtoACH0usingconnectionwireontheprototype
board.
14. TurnELVISunitonincludingtheprototypeboard.
15. LaunchELVISapplicationandchoosefunctiongenerator.
16. Selectthefrequency,waveformtypeandamplitudeofthefunction
generatorandturniton.

SubmittinganExperiment

17. EntertheparametersforthecontrolsoftheLabVIEWdata
acquisitioncontrolsandrun.
18. Saveacquiredsignalforlabreport.

Experiment2,CreateaLabVIEWdataacquisitionapplicationof
continuoussamples:
1. ModifytheLabVIEWcodeofpreviousexperimentbychanging
thesamplemodeconstantforNIDAQmxtimingVIto10083
forcontinuoussampling.Removethewireconnectingthenumber
ofsamplescontroltothisVI.
2. Changethewaveformindicatortochartindicator.
3. UsingWHILElooptoenclosetheNIDAQmxreadVI.
4. RemovetheWriteLabVIEWMeasurementFileexpressVI.
5. Runtheapplicationasdescribedinthepreviousexperiment.

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

Theexperimenttitle
Theexperimentobjective
Theexperimentprocedureandtheory
Discussion
Youmayaddyourlabdesignintothisproject.

Pleasesubmitthereportthroughemail.

SubmittinganExperiment

Potrebbero piacerti anche