Analog to Digital Conversion.docx
《Analog to Digital Conversion.docx》由会员分享,可在线阅读,更多相关《Analog to Digital Conversion.docx(9页珍藏版)》请在冰豆网上搜索。
![Analog to Digital Conversion.docx](https://file1.bdocx.com/fileroot1/2023-5/26/b5bfecce-7887-4d0d-a905-e654833ce826/b5bfecce-7887-4d0d-a905-e654833ce8261.gif)
AnalogtoDigitalConversion
AnalogtoDigitalConversion
SamerEl-Haj-Mahmoud
ElectronicsEngineeringTechnologyProgram
TexasA&MUniversity
Instructor’sPortion
Summary
ThepurposeofthislabistoprovidethestudentswithhandonexperienceinusingtheanaloginputsofaNationalInstrumentsdataacquisitioncard.ThelabassumesthatthestudentshavepriorexposuretoLabVIEW,andthattheyknowthebasicsofwritinganddebuggingLabVIEWVIs(VirtualInstruments).TheexperimentwillteachthemhowtoapplytheirLabVIEWknowledgetoacquireananalogsignalfromthefunctiongenerator.TheywilldisplayitinLabVIEWandcalculateitsRMSandaveragevalues.ThestudentsshouldhavestudiedAnalogtoDigitalconversiontheoryinclassbeforecomingtothelab.
TheobjectiveforthisexperimentisforthestudentstowritetheneededLabVIEWVItosampleananalogsignalanddisplayitonawaveformchartinLabVIEW.Theinstructionsprovidedinthestudent’ssectiondescribeastep-by-stepapproachtowritethebasicstructureoftheVI.Therestoftheimplementationislefttothestudents.TheVIprovidedisasampleimplementationandisintendedfortheinstructor’sreferenceuseandnotforthestudents.ThediagramcanbepasswordprotectedincasethestudentswanttolookatthefrontpanelandseehowtheVItheyarewritingshouldbehave.
Uses
Thisexperimentappliestogeneralinstrumentationandelectronicssystemsinterfacingcoursesinelectricalengineeringorengineeringtechnologyprograms.TheexperimentcanalsobeusefulinbasicLabVIEWcourses,teachingtheconceptsofanaloginputthroughdataacquisitioncards,inadditiontootherLabVIEWtechniquessuchastheuseofWaveformChartsandtheuseofstatisticalfunctionssuchasRMSandMean.
EquipmentList
∙PCrunningMSWindows(visit forrequirementsspecifictoyouroperatingsystem)
∙LabVIEWFullDevelopmentSystem
∙PCI1200DAQfromNationalInstruments(partnumber777386-01)
∙CB-50LPI/OConnectorBlockfromNationalInstruments(partnumber777101-01)
∙NBIRibbonCablefromNationalInstruments(partnumber180624-10)
∙TektronixTAS475FourChannelOscilloscope,oranygenerallabscopewith2ormorechannels.
∙HP3312AFunctionGenerator,oranygeneralfunctiongeneratorwithsinusoidalandsqaureoutputsignalsofvariablefrequency.
Setup
Followthestepslistedbelowtopreparetheworkstationforthisexperiment.Theinstructionsassumeyouareusingtheequipmentlistshownpreviously.
Note:
MostofthemanualsthatarereferredtoshipwithNationalInstrumentshardwareandsoftware.Ifyoucan’tfindyourhardcopyofthemanuals,youcangetthemonlineatIf youencounterproblemsduringsetup,contacttechnicalsupportat
BeforetheDayoftheLab
1.InstallLabVIEW(seetheLabVIEWReleaseNotesforyourversionofLabVIEW).
2.InstallyourPCI-1200board(seethePCI1200UserManual,oronlineat:
3.ConnecttheribboncabletothePCI1200cardandtotheI/Oconnectorblock.
OntheDayoftheLab
4.Powerupthecomputer.
5.StartLabVIEW.
6.Powerupthefunctiongenerator.
References
∙NI’swebsite:
∙Schweber,William.ElectronicCommunicationSystems.UpperSaddleRiver:
Prentice-Hall,1999;p292-3.
∙Burns,MarkandRoberts.AnIntroductiontoMixed-SignalICTestandMeasurement.TexasInstruments,2000;p.174.
Student’sPortion
Introduction
Inthisexperiment,youwillwriteaLabVIEWVItoacquireananalogsignalfromtheanaloginputpinsofthePCI1200DataAcquisitionCard(DAQ),displayitinLabVIEW,andcalculateitsRMSandaveragevalues.Youwillalsoshowtherelationshipofamplitudetonumberofaverages.ThislabrequiresbackgroundinanalogtodigitalconversionandtheconceptsofsamplingandNyquisttheorem.TheseconceptsaresummarizedintheTheorysectionofthisexperiment.
Objective
TolearnhowtouseLabVIEWforanaloginputthroughaDAQcard.
TolearnaboutAnalogtoDigitalconversionandhowtoacquireasignalanddisplayitinLabVIEW.
Tostudytheeffectofthesamplingfrequencyinanalogtodigitalconversion.
Theory
In1928,H.Nyquistshowedthatananalogsignalcouldbeperfectlyreconstructedsolelyfromitssamplevalues.Thiscouldbedonewithoutanylossofitsoriginalinformationifthesamplingrateisatleasttwicethebandwidthofthesignal,thusthefamousrule:
Nyquistsamplingrate=2xsignalbandwidth
Forexample,asignalwithabandwidthof1000Hzmustbesampledat2000ormoresamples/secondwithoutanylossofinformation.
Figure1.Sineandcosinewavessampledattwicethesignalfrequency
(Source:
Burns,MarkandRoberts.AnIntroductiontoMixed-SignalICTestandMeasurement)
Samplingatexactlytwicethesignalfrequencyisnotenoughinmostpracticalsituations.Figure1illustratesthisproblem:
“Asisevident,allthesamplesfromthesinewavearezerowhereasthosefromthecosinesignalarenot.Clearly,anyinformationcontainedinthesinewavesuchasitsamplitudewouldbelostandunobtainablefromthesamples.WecanthereforeconcludethatoneshouldnotattempttosampleatexactlytwicetheNyquistrate”
(Source:
Burns,MarkandRoberts.AnIntroductiontoMixed-SignalICTestandMeasurement,P.174)
Thisiswhyasamplingrateasmuchas10timesthesignalbandwidthisusedwhendoingananologtodigitalconversion.
QuantizationErrors
Thetermquantizationerror(orquantizationnoise)isusedtodescribethefactthatadigitalvaluecancorrespondtoadistinctspanofanalogsignals.AnyanalogsignalwithinthezoneofoneLSBwillhavethesamedigitalvalueandthereforelookidenticaltoallothersaftertheanalog-to-digitalprocess.Itisthissmalldegreeoferrorinmisrepresentationthatisknownasquantizationerror.Inordertocloselyreconstructtheoriginalanalogsignal,theanalogtodigitalconversionprocessneedstominimizethequantizationerrorasmuchaspossible.Toreducethequantizationerror,moredivisions(higherresolution)shouldbeusedtorepresenttheanalogvalue.Forthisexperiment,thistypeoferrorisminimizedbythefactthatthePCI1200boardsuseadevicewithrelativelygoodresolution(12-bits).
Figure2.QuantizationError
(Source:
Schweber,William.ElectronicCommunicationSystems.p287)
Figure2,presentstheideathattheoriginalanalogsignal(a)canberepresentedinvaryingdegreesofresolutiontherebydeterminingtheamountofquantizationerrorincluded.Atwo-bitrepresentationasin(b)hasmorequantizationerrorthanthethree-bitrepresentationin(c).Infact,witheveryincreasingbitofresolution,quantizationerroriscutinhalf.
Pre-LabPreparation
Readthisexperimentbeforecomingtothelab.YoushouldunderstandtheconceptsofsamplingandquantizationerrorsandstudytheNyquisttheorem.
Bringthefollowingtolabwithyou:
∙Thisexperiment.
∙Yourlabnotebookandpencil.
∙2virus-freeformatted3.5-inchfloppydisks(alwaysmakeabackupcopyofyourcodeontheseconddisk).
Answerthefollowingquestionsinthedatasheetprovidedattheendofthisexperimentbeforecomingtothelab.Remembertoincludetheseanswersinyourlabreporttoo.
1.WhatarethepinnumbersforanalogoutputandanaloginputonthePCI1200DAQcard?
Howmanychannelsarethereforanaloginputandanalogoutput?
2.WhichVIisusedtoreadtheanalogsignalfromtheanaloginputpin?
3.WhichVIscalculatetheRMSandmeanvaluesofasignal?
WorkstationDetails
Yourworkstationshouldhavethefollowingitems:
∙ComputerwithNationalInstrumentsLabVIEWsoftware
∙NationalInstrumentsDAQboard(insidethecomputer)
∙NationalInstrumentsDAQboardterminalblock
∙TektronixOscilloscope.
∙HP3312AFunctionGenerator.
LabProcedure
1.StartanewVIinLabVIEW.Youshouldthenaddthefollowingcontrolsandindicatorstothefrontpanel:
a.Start/StopSwitch:
ThisisthemainOn/OffswitchfortheVI.
b.NumberofReadingsDigitalControl:
ThisvaluewillbeusedtocontrolthemainloopoftheVI.
c.NumberofSamplesperReadingDigitalControl:
ThisVIwilldeterminethenumberofbufferedsamplesforeachreadingfromtheanaloginput.
d.SampleRateDigitalControl:
ThisvaluewillconfigurethesamplingrateoftheanaloginputontheDAQ.
e.WaveformoftheAcquiredSignal:
Thischartwilldisplaytheacquiredanalogsignal.Itshouldmatchthesignalobtainedontheoscilloscopewhenmeasuredfromthefunctiongenerator.
f.RMSvalueDigitalIndicator:
YouwilldisplaytheRMSvalueofeachbufferedinputoftheacquiredsignal.
g.MeanvalueDigitalIndicator:
Youwilldisplaythemeanvalueofeachbufferedinputfromtheacquiredsignal.
h.AverageDCValueDigitalIndicator:
YouwilldisplaytherunningaverageDCvalue(averageofthemeanvalues)fortheentireacquiredsignal.
2.TheVIissupposedtoworkasfollows:
itreadsananalogsignalbyacquiringanumberof“samples”atacertain“samplingrate”(bufferedinput).Theacquiredsignal,alongwiththemeanandRMSvaluesofthosesamplesaredisplayedonthefrontpanel.Then,theprocessrepeats.Eachiterationoftheloopiscalledone“reading”.ItisalsorequiredtodisplaytheaverageDCvalue(averageofmeansforallreadings).
3.Afteraddingthosecontrols,startwiringtheVIdiagramswiththecontrolstoimplementthefunctionalityofyourprogram.YoumightfindthefollowingVIsusefulinyourcode:
a.Amainloop,bestimplementedasaForLoopstructure,whichwillbecontrolledbytheStart/Stopswitchandthenumberofreadingsdigitalcontrol.
b.AnAnalogInp