外文翻译AT89CX051微控制器的模拟数字变换器应用文档格式.docx
- 文档编号:19260009
- 上传时间:2023-01-04
- 格式:DOCX
- 页数:8
- 大小:42.55KB
外文翻译AT89CX051微控制器的模拟数字变换器应用文档格式.docx
《外文翻译AT89CX051微控制器的模拟数字变换器应用文档格式.docx》由会员分享,可在线阅读,更多相关《外文翻译AT89CX051微控制器的模拟数字变换器应用文档格式.docx(8页珍藏版)》请在冰豆网上搜索。
RCAnalog-to-DigitalConverter
Thisconversionmethodoffers.Anextremelylowcomponentcountattheexpenseofaccuracyandconversiontime.Intheexamplepresentedbelow,resolutionisbetterthan50millivolts,accuracyissomewhatlessthanatenthofaVoltandconversiontimeissevenmillisecondsorless.
AsshowninFigure1,theRCanalog-todigital.conversionmethodrequiresonlytworesistorsandacapacitorinadditiontotheAT89CX051microcontroller.Amicrocontrolleroutput(pin11),whichswingsfromapproximatelygroundtoVCC,alternatelychargesanddischargesthecapacitorconnectedtothe
non-invertinginputoftheinternalcomparator(pin12).Themicrocontroller
measuresthetimerequiredforthevoltageonthecapacitortomatchtheunknownvoltageappliedtotheinvertinginputoftheinternalcomparator(pin13).Theunknownvoltageisafunctionofthemeasuredtime.
TheHP5082-7300LEDdisplaysshowninFigure1arenotrequiredfortheconversion,butareutilizedbythesoftwaretoimplementasimpletwo-digitvoltmeter.Theresultoftheanalog-to-digitalconversionisdisplayedinvoltsandtenthsofavoltonthetwodisplays.ThevoltmeterapplicationdoesnotutilizethefullresolutionoftheRCconversionsoftware,butservestodemonstratethemethodaswellasprovidingatoolfordebug.
Thewaveformforatypicalcapacitorcharge/dischargecycleisshowninFigure2.ThedischargeportionofthecurveisidenticaltothechargeportionrotatedaboutthelineVC=VCC/2.Theequationsanddiscussionbelowapplytothechargeportionofthecycle,exceptwhereindicated.
Thevoltageonthecapacitorasafunctionoftimeisgivenbytheexponentialequation:
VC=VCC(1-e-t/RC)
(1)
whereVCisthevoltageonthecapacitorattimet,VCCisthesupplyvoltageandRCistheproductofthevaluesoftheresistorandcapacitor.NotethatvoltageisexpressedinVolts,timeinseconds,resistanceinOhmsandcapacitanceinFarads.TheproductRCisalsoknownasthe“timeconstant”ofthenetworkandaffectstheshapeofthewaveform.Thewaveformissteepestwhencapacitorchargingordischargingbeginsandflattenswithtime.
ThefirstproblemwiththeRCconversionmethodisthedifficultyofsolvingtheexponentialequationwithoututilizingfloatingpointcalculationsandtranscendentalfunctions.Onacompressedtimescale,theexponentialcurveappearsstraightovermuchofitslength,suggestingthatitmightbeapproximatedbyaline.Thisschemefailsduetothecontinuousvariationinslopeoverthelengthofthecurve,whichproducessignificanterror.ItalsodoesnotaddresstheproblemwherethecurverollsoffseverelyneartheasymptoteatVCC.
Themicrocontrollerneednotsolvetheexponentialequationinrealtimeifalookuptableisusedtomappre-calculatedvaluestoeachsampledtimeinterval.Thisschemeallowsthedatatobeencodedandformattedasrequiredbytheapplicationwhilesimplifyingtheconversionsoftware.Symmetriesinthedatamaybeexploitedtoreducethesizeofthetable.
ThesecondproblemwiththeRCconversionmethodisthesubstantialerrorwhichresultsfromvariationsincomponentvalues.Figure3showsanexaggeratedviewofthevariationinthevoltageonthecapacitorduetovariationsinthevaluesoftheresistorandcapacitor.Asshowninthefigure,thevariationinthevoltageonthecapacitordecreasesasthevoltageonthecapacitordecreases.
Thesymmetryofthecapacitorcharge/dischargecyclecanbeexploitedtoreducetheeffectofvariationsincomponentvaluesonconversionaccuracy.ThisisdonebyutilizingthechargeportionofthecycletomeasurevoltageslessthanVCC/2andthedischargeportiontomeasurevoltagesgreaterthanVCC/2.TheworstcaseerrorisreducedtotheerroratVCC/2.
Beforecomponentvaluescanbeassigned,thetimeintervalatwhichthecomparatoroutputistobesampledmustbedetermined.Thesampleintervalshouldbeasshortaspossibletomaximizeconverterresolutionandminimizeconversiontime.Thesampleintervalislimitedbythetimerequiredtoexecutetherequisitecode,whichisdeterminedbytheclockrateofthemicrocontroller.Inthevoltmeterapplication,themicrocontrolleroperateswitha12-MHzclock,resultinginasampleintervaloffivemicroseconds.
Thetimeconstant(RC)affectstheshapeofthecapacitorcharge/dischargewaveform.Thevalueofthetimeconstantmustbechosensothatthesteepestpartsofthewaveformareresolvabletothedesiredresolution.Thesteepestpartofthechargeportionofthewaveformoccursneartheorigin,whilethesteepestpartofthedischargeportionoccursnearVCC.Duetothesymmetryofthewaveform,thesametimeconstantmaybeusedformeasurementsmadeoneitherportionofthewaveform.
Figure4showsanexpandedviewoftherelationshipbetweenvoltageandsampletimeneartheorigin.Inthefigure,Visthedesiredvoltageresolutionoftheconverterandtisthesampleintervaldeterminedpreviously.Thecurvelabeled’VC’representsthevoltageonthecapacitor,
whichappearslinearatthisscale.Inthefigure,theslopeofthecurveisideal,causingsamplingtooccurnearthecenterofthevoltageintervals.Theslopeofthecurvemaybelessthanshown,butmaynotbegreater,orresolutionwillbelost.Notethatthefirstsampleisoffsetfromtheoriginby1/2
tocenterthesampleinthefirstvoltageinterval.Toobtaintheminimumvalueofthetimeconstantwhichwillproducetherequiredslopeatthefirstsample,solveEquation1forRC:
RC=-t/1n(1-VC/VCC)
(2)
Thenset
totheminimumdesiredresolution(0.05-volt),
tothesampleintervaldeterminedpreviously(fivemicroseconds),andcalculateRCatthefirstsamplepoint,where
VC=1/2
andt=1/2
:
TheproductofthevaluesofRandCmustnotbelessthanthecalculatedminimumtimeconstant.Utilizingaresistorwithaonepercenttoleranceandacapacitorwithafivepercenttolerance
(Rnorm-1%)(Cnorm-5%)>
4.99*10-4
Inthevoltmeterapplication,theselectedvaluesofRandCare267kilohmsand2nanofarads,respectively,yieldingaminimumtimeconstantofapproximately5.02•10-4.AnadditionalconstraintisplacedonthevalueofR.ReferringagaintoFigure1,notethe5.1kilohmpullupresistor
connectedtopin11ofthemicrocontroller.Thisresistorispresenttosupplementthemicrocontroller’sweakinternalpullup,buthasthedetrimentaleffectofchangingthetimeconstantoftheRCnetworkduringthechargeportionofthecapacitorcharge/dischargecycle.Thisproducesanasymmetryinthecharge/dischargewaveform,whichcontributestoconversionerror.Tominimizetheeffectofdifferencesinthecapacitorchargeanddischargepaths,thevalueofRshouldbechosentobemuchgreaterthanthevalueofthepullupresistor.Inthevoltmeterapplication,theselectedvalueofRis267kilohms,whichexceedsthevalueofthepullupresistorbymorethananorderofmagnitude.
Thetimeconstant(RC),whichisafunctionofthedesiredconverterresolution,determinesthedurationofthecapacitorcharge/dischargecycle.Themoretimerequiredforthecapacitortochargeanddischarge,thegreaterthenumberofsamplesrequiredinthemeasurementloopandthegreaterthenumberofentriesinthelookuptable.
Figure1.TypicalCapacitorCharge/DIschargeCycle
Figure2.CapacitorVoltageVariationasaFunctionofRCVariation
Figure1.Figure2
Ctothesymmetryofthecapacitorcharge/dischargewaveform,thedeterminedsamplecountmaybeusedformeasurementsmadeduringeitherportionofthecycle.
FromEquation3:
tmax=-RmaxCmax•ln(1-(1/2)VCC/VCC)
=-(Rnom+1%)(Cnom+5%)ln(1/2)
=-(1.01)(267•103)(1.05)(2•10-9)ln(1/2)
=393s.
Theminimumnumberofsamplesforhalfthecycleis:
tmax/t=(393•10-6)/(5•10-6)=79
Tomaximizeaccuracy,voltagesfromzerotoVCC/2aremeasuredduringthechargeportionofthecapacitorcharge/dischargecycleandvoltagesfromVCCtoVCC/2aremeasuredduringthedischargeportionofthecycle.Asaresult,thetotalnumberofentriesinthetableistwicethenumberofsamplescalculatedpreviouslyforeachhalfcycle.Thelookuptablecontainsapplication-specificvaluescorrespondingtothecalculatedvoltageateachsample.Foreachhalfcycle,theNthentryinthetablecorrespondstothevoltageatt=(N-1)t,wheretisthesampleintervaldeterminedpreviously.Forthechargehalfcycle,thevoltageateachsampleiscalculatedbysolvingEquation1forthetimeelapsedsincethecapacitorbegantocharge.Forthedischargehalfcycle,thevoltageateachsampleiscalculatedbysolvingthefollowingequationforthetimeelapsedsincethecapacitorbegantodischarge:
VC=VCC•e-t/RC(3)
Thesizeandcontentsofthetablemayvaryfromapplicationtoapplicationdependingonthesampleintervalandconversionresolution.Astheresolutionincreases,thenumberofentriesinthetablegrows.
Inthevoltmeterapplication,withresolutionequalto0.05Volt,thelookuptablecontains158entries,whichistwicethenumberofsamplesperhalfcyclecalculatedabove.
Voltagescorrespondingtosamplestakenduringthechargehalfcyclearecalculatedbyreplacing’t’with’Nt’inEquation1,whereNrepresentsthesamplenumber(0-78).Bysettingtequaltothesampleintervalof5microseconds,Rto267kilohms,Cto2
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 外文 翻译 AT89CX051 控制器 模拟 数字 变换器 应用