单片机类毕业设计外文翻译.docx

上传人:b****6 文档编号:6027333 上传时间:2023-01-03 格式:DOCX 页数:30 大小:228.07KB
下载 相关 举报
单片机类毕业设计外文翻译.docx_第1页
第1页 / 共30页
单片机类毕业设计外文翻译.docx_第2页
第2页 / 共30页
单片机类毕业设计外文翻译.docx_第3页
第3页 / 共30页
单片机类毕业设计外文翻译.docx_第4页
第4页 / 共30页
单片机类毕业设计外文翻译.docx_第5页
第5页 / 共30页
点击查看更多>>
下载资源
资源描述

单片机类毕业设计外文翻译.docx

《单片机类毕业设计外文翻译.docx》由会员分享,可在线阅读,更多相关《单片机类毕业设计外文翻译.docx(30页珍藏版)》请在冰豆网上搜索。

单片机类毕业设计外文翻译.docx

单片机类毕业设计外文翻译

ADCOversamplingTechniquesforStellarisFamilyMicrocontrollers

Introduction

LuminaryMicroprovidesananalog-to-digitalconverter(ADC)moduleonsomemembersoftheStellarismicrocontrollerfamily.ThehardwareresolutionoftheADCis10bits;however,duetonoiseandotheraccuracy-diminishingfactors,thetrueaccuracyislessthan10bits.Thisapplicationnoteprovidesasoftware-basedoversamplingtechnique,resultinginanimprovedEffectiveNumberOfBits(ENOB)intheconversionresult.Thisdocumentdescribesmethodsofoversamplinganinputsignal,andtheimpactonprecisionandoverallsystemperformance.

Oversampling

Asthenameimplies,oversamplinggathersadditionalconversiondatafromaninputsignal.StandardconventionforsamplingananalogsignalindicatesthatthesamplingfrequencyfSshouldbeatleasttwicethatofthehighestfrequencycomponentfHoftheinputsignal.ThisisreferredtoastheNyquistTheorem(seeEquation1).

Equation1.NyquistTheorem

fS=2fH

AnysamplingfrequencyselectedabovefSisconsideredtobeoversampling,andwhencombinedwithaveragingtechniques,improvestheENOB.Thisispossiblebecauseaveragingtheoversampledresultsalsoaveragesthequantizationnoise,thusimprovingtheSignal-to-NoiseRatio(SNR),whichhasadirecteffectontheENOB.

Foreachbitofaccuracyimprovement,thesignalmustbeoversampledbyafactoroffour,meaningthattherelationshipbetweentheoversamplingfrequencyfOSandsamplingfrequencyfSisasshowninEquation2.

 

Equation2.OversamplingFrequency

fOS=4x*fS

wherexisthedesiredimprovementontheENOB(forexample,fortwobitsofimprovement,x=2).

Figure1showshowoversamplingimprovestheaccuracyoftheconversionresult.Inthisdiagram,theinputsignalisoversampledby4(samplegroupsareshowningreenandpurple)andaveraged.Thesamplepointsshownillustratethedifferencebetweentheraw,noisysignalandtheaverage;thenoiseinthisexampleaffecting±3bitsofaccuracyonanindividualsample.Notethattheaveragedvalues(orangedots)aremuchclosertotheidealvaluethanmostofthesinglesamples.

Averaging

 

Averagingactsasalow-passfilterontheinputsignal,withthepassbandofthefilternarrowingasthesamplesizeincreases.Whenaveragingconversionresults,therearetwoapproachesthatcanbetaken:

normalaverageorrollingaverage.

NormalAverage

Takingnsamples,addingthem,anddividingtheresultbynisreferredtoasanormalaverage,andisshowninFigure1.Whenusingnormalaveraginginanoversamplingscenario,afterthetechniqueisapplied,thesampledatausedinthecalculationisdiscarded.Thisprocessisrepeatedeverytimetheapplicationneedsanewconversionresult.

Figure1.AveragedConversionResults

Inanapplication,thenormalaveragingapproachisideallyusedincaseswherethesamplingfrequencyislowcomparedtothesamplingrateoftheADC.

Important:

Whenoversamplingbyninanormalaveragingscenario,theeffectiveADCsamplerateisreducedbythatsamefactor.Forexample,oversamplinganinputsignalby4cutsthemaximumeffectiveADCsamplerateby4,meaningthata250K-samples/sADCeffectivelybecomesa62.5K-samples/sADC.

Figure2showsasituationwherenormalaveragingisusedtooversampleaninputsourceby4.Forthisexample,theapplicationrequiresthatanewconversionvaluebeready(averagingcomplete)ateachstepoft(t0,t1,t2,andsoon).

Whenusingaveragingtechniques,thereisaslightdelayassociatedwiththecalculatedconversionresultsinceitcorrespondstotheaverageofthelastnsamples.ThedelaycanbecalculatedusingtheformulashowninEquation3.

Equation3.AveragedSampleDelay

tdelay=(tSn–tS0)/2+tprocess

wheretS0isthetimeatwhichthefirstsampleoftheaverageoccurs,andtSniswherethelastsampleoccurs.Thetimerequiredbytheinterrupthandlertoprocessthesampledataandcalculatetheaveragetprocesstosupplytotheapplicationisalsofactoredintotheequation.InFigure2,thedelayedconversionresultishighlightedinorange.

RollingAverage

Arollingaverageusesasamplebufferofthenmostrecentsamplesintheaveragingcalculation,allowingtheADCtosampleatitsmaximumrate(theADCsamplerateisnotreducedbynasinnormalaveraging),makingitideallysuitedforapplicationsrequiringoversamplingandhighersamplerates.Thesamplebuffercanbeprefilledwithvalidsampledata(bytakingn–1samplespriortothefirst“real”datapoint),orcanbeleftinanunknownstate,dependingontheapplication.Thedisadvantageofnotprefillingthebufferisthatthefirstn–1samplescontaininvaliddataandadverselyaffecttherollingaveragecalculation.Ifacceptablebytheapplication,bufferpaddingcanbeeliminatedifthesoftwarecanaccountforthepossibilityofthefirstn–1samplesbeingskewed.

Figure3showsanexampleofoversamplingwitharollingaverage.Thediagramshowsacasewheretheinputsignalisoversampledby4,meaningthatthesamplebufferusesthe4mostrecentsamplestocalculatetheaverage.Inthisexample,theapplicationrequiresanewsampleateachstepoft.Beforethefirstoversampledresultiscalculatedatt0,thesamplebuffercollectsthreesamplessothatthefirstdatasuppliedtotheapplicationisvalid.

Figure2.NormalAveraging

Whenusingarollingaverage,thesamesampledelaycalculatedbyEquation3applies.InFigure3,thedelayedvaluesfort0,t1andt2(shownasd0,d1andd2,respectively)arehighlightedinorange.

Important:

Usingarollingaverageaddsadditionalprocessingoverheadduetothesamplebuffermanipulationthatmustbeperformedduringeachinterrupt.

Implementation

LuminaryMicro’ssamplesequencerarchitectureintheADCmakesoversamplingsimplebyallowingforupto17uniquesamples(fromanyoftheanalogchannels)tobecollectedusingasingletrigger.Thisallowsforflexibilityinsoftwarebyprovidingthemeansforanapplicationtooversampleanumberofchannelsatanygiventime.

ThissectionshowsvariousimplementationsofoversamplingusingtheStellarismicrocontrollers.Therearenumerousmethodsthatworkusingcombinationsofsamplesequencerconfigurations,ADCtriggersandinterrupts,however,theexamplesshownherefocusontechniquesthataremostlikelytobeused.

AlltheexamplecodeusestheStellarisFamilyDriverLibraryADCfunctions.ThesourcecodefortheDriverLibraryandthesoftwareexamplesshowninthisapplicationnotecanbefoundontheLuminaryMicrowebsiteat.

Figure3.RollingAverage

OversamplingUpto8TimesUsingtheDriverLibraryFunctions

TheStellarisDriverLibraryhasbuilt-infunctionsthatallowoversamplingupto8times.Formostapplications,thislevelofoversamplingissufficientsincetheimprovementontheENOBisapproximately1.4bits.

UsingtheDriverLibraryoversamplingfunctionsistheeasiestwaytooversampletheinputsignal.Themaindifferencebetweenconfiguringa“typical”ADCconversionandanoversampledconversionisthefunctioncalls.TheoversamplingfunctionshaveanADCSoftwareOversampleprefix,andareeasilydistinguishedfromthestandardADCfunctions.

OncetheparametersfortheADCconversionprocessaredetermined(samplefrequency,triggersource,channel,andsoon),writingthecodeisstraight-forward.Forexample,thecodetosetupa10-msperiodicconversion(triggeredbyatimer)thatisoversampledby8consistsofthecodesegmentsshowninExample1.

Example1.8xOversamplingwiththeDriverLibraryFunctions

CodeSegment1.a.ADCConfiguration–DriverLibraryFunctions

//

//InitializetheADCtooversamplechannel1by8xusingsequencer0.

//Sequencerwillbetriggeredbyoneofthegeneral-purposetimers.

//

ADCSequenceConfigure(ADC_BASE,0,ADC_TRIGGER_TIMER,0);

ADCSoftwareOversampleConfigure(ADC_BASE,0,8);

ADCSoftwareOversampleStepConfigure(ADC_BASE,0,0,(ADC_CTL_CH1\

|ADC_CTL_IE|ADC_CTL_END));

//

//InitializeTimer0totriggeranADCconversiononceevery10milliseconds

//

TimerConfigure(TIMER0_BASE,TIMER_CFG_32_BIT_PER);

TimerLoadSet(TIMER0_BASE,TIMER_A,SysCtlClockGet()/100);

TimerControlTrigger(TIMER0_BASE,TIMER_A,true);

TheADCconfigurationshowninCodeSegment1.adictatesthataninterruptoccurwhensamplingcompletes,meaningthataninterrupthandlermustbeimplemented(seeCodeSegment1.b).SincetheDriverLibraryoversamplingfunctionsautomaticallyaveragethesampleddata,theinterrupthandlerfunctionisrelativelybasic.Keepinmindthathavingtheaveragecalculatedduringeachinterruptaddscomputationaloverheadtotheinterrupthandler.

CodeSegment1.b.ADCInterruptHandler

void

ADCIntHandler(void)

{

longlStatus;

//

//CleartheADCinterrupt

//

ADCIntClear(ADC_BASE,0);

//

//GetaverageddatafromtheADC

//

lStatus=ADCSoftwareOversampleDataGet(ADC_BASE,0,&g_ulAverage);

//

//PlaceholderforADCprocessingcode

//

}

Withtheconfigurationstepsandinterrupthandlerinplace,theconversionprocessisinitiated.Beforethetimeristurnedon(beginscounting),theADCsequencerandinterruptmustbeenabled(seeCodeSegment1.c).

CodeSegment1.c.EnablingtheADCandInterrupts

//

//EnableADCsequencer0anditsinterrupt(inboththeADCandNVIC)

//

ADCSequenceEnable(ADC_BASE,0);

ADCIntEnable(ADC_BASE,0);

IntEnable(INT_ADC0);

//

//Enablethetimerandstartconversionprocess

//

TimerEnable(TIMER0_BASE,TIMER_A);

OversamplingMoreThan8TimesUsingMultipleSequencersoraTimer

TheDriverLibraryoversamplingfunctionsarelimitedtooversamplingby8times

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 自然科学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1