基于单片机的酒精测试仪毕业论文_第1页
基于单片机的酒精测试仪毕业论文_第2页
基于单片机的酒精测试仪毕业论文_第3页
基于单片机的酒精测试仪毕业论文_第4页
基于单片机的酒精测试仪毕业论文_第5页
已阅读5页,还剩21页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

中文译文AT89CX051微制器的模拟-数字变换器应用AtmelAT89C1051和AT89C2051微控制器是具有低引脚数和宽工作电压范围的单片闪光器()和不可缺的比较器。这篇应用手册描述了这两种低成本的数字化变换技术。它们被用于AtmelAT89C1051和AT89C2051微控制器的比较器中。这种变换方法组成简单,但准确下降和变换时间长。在下列提到的例子中,分辨率超过50毫伏,准确性低于0.1volt或是更少。变换时间为7毫秒或是更少如图一所示,如果采用RC模拟数字转换方法只需要一个AT89CX051微控制器,两个电阻器和一个电容器。微控器的输出(11)大约从零和V间变化。它交替为电容充放电。这个电容器与部比较器的非反向输入相连(12脚微控制器计算电容器电压达到与内部变换较器输入电压的时间。比较器电压要和未知输入电压相匹配(13脚未知电是所测时间的函数。在图一中HP5082-7300LED所显示不需要变化,但是要用软件来实现简单二进制电压作用。模数变换器在两个示屏上显示伏特和0.1伏特。电压分辨率不利用RC转换软件的判别,它在提供试工具的同时也给出了一个方法。典型电容器充放电周期波形如图所示。放电部分曲线和充电部分曲线相同,大约都在V=V=2线上。除了给出的说明的地方,放电部分周期运用了下面的方程和讨论:下列指数方程中,电容器的电压时间的函数:

V(1/CCC

)其中V是t时刻的电容器电压是给定电压,RC是电容器和电阻器值的乘积。电压单位为伏,时间单位为。电阻为欧姆,电容为法拉。乘积RC为时间恒量,影响网络的波形。当电容器充放开始时波形最陡,并随时间变化。不能用浮点计算和超函数来求解指数方程是RC换方法的首要问题。在一个压缩的时间范围里,指数曲线呈现远远超出其宽度的升趋势,近似为垂线。曲线在横向的持续变化超过了横向变化,产生了很大的误。是这种方法失败的原因。而且它不能解决曲线在渐近线V附近剧烈震动的问。如每一次取样时间间隔里用查表绘出计算初值,微型控制器不需要适时解决数方程。这种方法在简化变换软件时,可以根据应用需要把数据编码和格式化。能使数据对称以减小表的大小。RC转换方法的第二个问题是方各项值变化引起的固有误差。图三是电阻电容积值的变化导致电压变化的放大。如图所示,随着电容电阻乘积中电压减小,电容电压随之减小。电容器充放电周期的对称减小了容电阻乘积值变化带来的影响,提高了变换准确性。这是通过周期充电部分计算电压小于V/2而放电部分的计算电压大于V/2。误差在V/2达到最小在RC被赋值之前,比较器输出样时间间隔必须确定。采间隔应尽可能小以缩短变换时间和增大变换分率采样间隔受执行必要编码所需时间限制。编码时间由微控制器的时钟速度决定。伏特计应用中,由于微控制器在12MHZ时下运行,每五微秒为一个采样间隔。时间恒量RC影响着电容器充放的波形。时间恒量必须选择合适的值以使波形最陡部分达到所需的分辨水平。电部分的波形最陡出现在原点附近,而放电部分则出现在V附近。由于波形的称,两个部分的波形可能用同一时间恒量来计算。图四是电压和原点附近采样时间系放大图。在图中,是换器达到所需分辨率的所需电压。

是先前所定的采样间隔。曲线坐V表示电容电压,在曲线中呈直线。在图中,由于采样在压间隔中心进行,所以曲线的斜面是理想的。实际可能要小一些。也有可能大或者分辨率会减小。将样时间间隔从原点偏移1/2t以后,其中心点对应第一次电压隔采样点。为了求得第一次采样所需斜面,获得时间恒量的最小值,解方程一得RCln(1/)CC然后设

为所需分辨率得最小值(0.05volt,间为先前确定的采样间隔(5毫秒。在第一个采样点=计算RC。其中VC=1/2,t=1/2Cmin

(ln[1)/CC

2)(5(1/2)(0.05)/VCC

4.99

R和C的乘积不能小于计算出的间恒量最小值。用带1%公差电阻和5%公差电容:(Rn)(C-5%)>4.99*10

在伏特计中,R和C的值选择别为267欧和微法。得到一个最小时间恒量大约5.02*10

另外一个约束条件是R的值。提到图一,5.1上拉电阻连接微控制器的11脚。这个电阻是微控制器内部上。但是在电容器充放电周期的充电过程中对网络RC的时间恒量有决定性影响。产生不对称的充放电波。能造成变换误差。为减小电容器充放电通道差异的影响,

R的值应选得比上内值大得多。在伏特计

应用中,R的值选择为267欧姆,值远远大于上拉内阻。时间恒量(RC)决定了电容器放电周期的持续时间。它是所需变换分辨率的函数。电容器充放电所需时间越,在计算周期所需的采样量越多,查找表个数越多。电容器充放电所需的时间通过计电容电压从渐近线上升到最小可晰电压间隔一半所需的时间来近似得到。波的充电部分,渐近线在V。由于波形的对称,定值同时用在周期充电和放电部分解方程

1得到时间:

t(1/V)CC设V为。所需电压为:V=V-(1/2)(0.05)=V

-0.025VVmaxmax由方程三:R1%)(C5%)InV)normnormCC(1.01)(267)In5.0)所需测量回路采样最小值通过计电容器电压达到V/2得到根据不同采样间隔划分。如果电容电压上升缓慢而电容电阻值很大,时间常数用最大值计算。由于电容器充放电波形的对称,采数将同时在周期的两个部分代入计算。从方程3

(1(1/VmaxCC1%)(C5%)In(1/2)normnorm(1.01)(267

)(1.05)(2.10

)(1/393

半周期最小采样数为:

tmax/(393/(5为了提高准确性,在周期充电部电压计算从0/2,而放电部分从V到1/2V。在表中总个数是先前每周期计算采样数的二倍。查表包含软件一个专门值。它和每次采样计算电压值相应。对每半个周期,平台第N个值对应t=(N-1)时电压。是先前确定的采间隔。对充电半周期,通过求解方程一得到电容开始充电起消耗时间,来求得每次采样的电压。对放电半周期,通过求解下列方得到电容器开始放电起消耗时间,求得每次采样电压。

VC

放电半周期采样对应电压通过在程4中用N

代替

t计算。其中N表示采样数,在充电半周期中也用同一值。方程4变成:V=5*e电容器充放电周期电压计算略表下。

电压在前半周期中上升,在后半期中下降。它变化轨迹决定了表数的排列。如表所示,每半周期的采样数大所需中等大小值2.500v。它可以在每次半周期最后采样前实现比一般中间值更快周期。在所需分辨率0.050v。记下N=,N=1时采样计算电压的差值。但是近采样的电压随着N的增而下降。在一个周期中。电压和时间表现非线性关系。表中所列计算电压没有加入查找。但用来确定表数。在伏特计应用中,计算电压在0.1伏周围,结果储存packed-BCD式的表中,两个数字一比特。例子:对应2.523伏的表中十进制的25,示2.5v伏特计原件的精度是+/-1()但即使使用精密元件,通过RC模拟-数字变换方法无法到达这个精度。不同元件值可能造成+/-0.104伏的误差,如下所示,计算最坏情况下误差V=。首先用方程3确与和一般值对应的t结果显示在2.5v处0.208v的变化。或是+/-0.104v的坏误差。最差的变换误差可以通过用较小公差元件来一步减小。变换准确性和线性受电容器特性的影响。伏特计元件中使用的电容器聚苯乙烯薄膜,虽然准确性不好,但因隔绝了吸收和其他影响而减小了误差。没有被测试的误差源包括:比较的局限性,充放电周期的不对称性,电容器电压达不到起点或是V,V的化。这些因素造成的变换误差比单独的元件误差值大。这种转换方法虽然增加元件数但高了分辨率和准确性。并缩短了转换时间。连续近似(sa)结合一个字模拟转换器,一个比较器和一个连续近似电阻()当反馈DAC时,SAR通执行二进制代码的搜索,将产生与电压相配的输出。比较器比较DAC未知电压输出,并返回SAR的结果。SAR开始搜索控制最宽输出变化最主要的DACbit,由DAC输出在未知值下为零输入SAR在最小主要位周围动。实验结果为未知值对应二进制编。在一个8位转换器中,要八次反复才能找到正确的二进制编码。得到相的快速变换。在这个应用中,一个带积分模拟较器AT89CX051微制器执行软件中SAR功能。减少元件数。软件DAC的择是一个MC1408-8,8位,低消耗的电流输出类型。7和6比特型相对来说适合于MC1407和MC1408-6连续在1.992毫安下+/-1/2LSB,度全输出电流围确保准确。MC1408-8的准确性超过0.19%,保证了八位的单一性和线性。DAC输设定时间为300亿分之一秒DAC包含二进制加权,用的二进代码检测输入电流的电流导引开关。输入电流由LM336-2.精密电压参源和一台连续电阻器得到。按比例绘制的当前输出变为一操作放大器电压,作为一流对电压I/V)变器。选做电流电压变化器。因为变换器有低的输补偿电压和高的输出旋转比率,电流电压变换器的输出被送入AT89CX051比器,和未知的电压比较。当被编译电压超过未知的电压时,比较器的输出变大,这软件检测。第个在一个非反向运算放大器,统一获得缓冲区可能被在未知的电源和提供间隔的AT89CX051比较器输入之间插入一个统一缓冲区。LM336-2.5参考提供名义上的2.490伏特的输出。实际电压可能从2.390伏特变化2.590伏特。在LM336-2.数据表里表明的方法使基准电压和温度系数相平衡。连接DAC14脚的前参考电阻器(Rref)的额定值是1240欧姆,产生一个2.490V欧(Vref/Rref)=2.008milliamps的参考电流。在DACscaleslref用比从0/256到255/256二进制编码,输出结果从零到(Io)(Iref0/256)到2.000mA(Iref255/256)。记下到DAC输出电流的信号是和参考(输入)电的信号相对。输电压由DAC输出电流以i/V变换器的值得乘积来确定。表面输出电压是2.000mA.2500欧(IoF.S;Ro)=5.000伏。电路不提供补偿调整。由于LF355B运算放大器振幅有较低偏移电压,所以偏移电压不需要调整。如果偏移电压调整,增加补偿在LF355B数据表内加入了电路偏移修正。随着I/V变换器获电阻器值的改变,结果可能变化。电阻器连接非反向运算放大器的输入应该具有相值以作为获得电阻器与输入偏移电流平衡。1240欧电阻器连接DAC的脚15,2500欧电阻器和运算放大器脚3连接可能相抵消,性能稍微下降。MC1408-8DAC需要提供+5.0-5.0的源;选择±5.0伏使功耗减到最小。LF355B运算放大器要提供±5.伏和±15伏双极的电源。为与DAC兼容选择-0.5v为负极,也可根需要用-15v代替。正极电源可选择+15v,这样可限制运算放大器输出的抖动,达到较器输出限制5v以上。A到D变换的速度受DAC输出定时间,运算放大器的旋转速度和设定时间,比较器响应时间和旋转速度和执连续近似算法所需时间的限制。DAC输出设定时间和比较器执行SA算法所需响应时间是可以忽略的。从输入到运算放大器最大电压是5伏,需要一微秒旋转间和(看数据表)4微秒的停滞时间。这种延迟在软件里适用;参考附信息的目录。一台12MHz处理器时钟和一微秒指令周期的输出结果,8位的变可以在被300微秒进行。未知输入电压在变化时必须保持不变的量。这里提出逐步近似法模数转换器的明显缺陷是需要双极的电源和大量微控制器I/O脚来制。+15伏特源可能通过一个带单独的电源的LF355B运算放大器代替,单独的电压源为5v,作用和在标记摆动的输出等同。控制DAC的微控制器I/O脚的数量以通过用7或6位DAC代替来减少。并行输入DAC可被连续的DAC输入替换(更昂贵交,逻辑交替的加入以接收微控制器的连续数据和DAC当前并行数据。这应用软件可能Atmel的BBS下载获得:(408)436-4309.请在源代码件的开始时参见意见块以获得关于特征和操作的详细资料。附录外文文献Analog-to-DigitalConversionUtilizingtheAT89CX051MicrocontrollersTheAtmelAT89C1051andAT89C2051.microcontrollersfeatureon-chipFlash,lowpincount,wideoperatingvoltage,rangeandanintegralanalogcomparator.Thisapplicationnotedescribestwolow-costanalog-to-digitalconversiontechniqueswhichutilizetheanalogcomparatointheAT89C1051andAT89C2051microcontrollers.RCAnalog-to-DigitalConverterThisconversionmethodoffers.Anextremelylowcomponentcountattheexpenseofaccuracyandconversiontime.thepresentedbelow,resolutionisthan50millivolts,issomewhatlessthantenthaVoltandconversiontimeissevenmillisecondsorless.AsshowninFigure1,theRCanalog-todigital.conversionmethodrequiresonlytworesistorsandacapacitorinadditiontotheAT89CX051microcontroller.microcontrolleroutput(pinwhichswingsfromapproximatelygroundtoVCC,alternatelychargesanddischargesthecapacitorconnectedtothenon-invertinginputofthecomparator(pin12).Themicrocontrollermeasuresthetimerequiredforthevoltagethecapacitortomatchtheunknownvoltageappliedtotheinvertinginputoftheinternalcomparator(pin13).Theunknownvoltageisafunctionofmeasuredtime.TheHP5082-7300LEDdisplaysshowninFigurearenotrequiredfortheconversion,butareutilizedbythesoftwaretoimplementsimpletwo-digitvoltmeter.Theresulttheanalog-to-digitalconversionisdisplayedinvoltsandtenthsofavoltontwodisplays.ThevoltmeterapplicationdoesnotutilizethefullresolutionoftheRCconversionsoftware,butservestodemonstratethemethodaswellasprovidingatooldebug.Thewaveformforacapacitorcharge/dischargecycleisshowninFigure2.ThedischargeportionthecurveisidenticaltothechargeportionrotatedaboutthelineVC=VCC/2.Theequationsanddiscussionbelowapplytochargeportionofthecycle,whereindicated.Thevoltageonthecapacitorasfunctionoftimeisgivenbytheexponentialequation:VC=VCC(1-e(1)whereVCisthevoltageonthecapacitorattimet,VCCisthesupplyvoltageandRCistheproductofthevaluesoftheresistorandcapacitor.NotethatvoltageisexpressedinVolts,timeinseconds,resistanceinOhmsandcapacitanceinFarads.TheproductRCisalsoknownasofthenetworkaffectstheshapeofthewaveform.Thewaveformsteepestwhencapacitorchargingordischargingbeginsandflattenswithtime.ThefirstproblemwiththeRCconversionmethodisthedifficultyofsolvingtheexponentialwithoututilizingfloatingpointcalculationsandtranscendentalfunctions.Onacompressedtimescale,theexponentialcurveappearsstraightovermuchofitslength,suggestingthatitmightbeapproximatedaline.Thisschemefailsduetocontinuousvariationinslopetheofthecurve,whichproducessignificanterror.ItalsodoesnotaddresstheproblemwherethecurverollsofftheasymptoteatVCC.Themicrocontrollerneednotsolvetheexponentialequationinrealtimeifalookuptableisusedtomappre-calculatedvalueseachsampledtimeinterval.Thisschemeallowstobeencodedformattedasrequiredbytheapplicationwhilesimplifyingtheconversionsoftware.Symmetriesinthedatamaybeexploitedtoreducethesizeofthetable.ThesecondwiththeRCconversionmethodisthesubstantialerrorwhichresultsfromvariationsincomponentvalues.Figure3showsanexaggeratedviewofthevariationinthevoltageonthecapacitorduetovariationsinthevaluesoftheresistorandcapacitor.Asshowninthethevariationinthevoltageonthecapacitordecreasesasthevoltageonthecapacitordecreases.Thesymmetryofcapacitorcharge/dischargecyclecanbeexploitedtotheeffectofvariationsincomponentvaluesconversionaccuracy.ThisisdonebyutilizingthechargeportionofthecycletovoltageslessVCC/2andthedischargeportiontovoltagesgreaterthanVCC/2.TheworstcaseerrorisreducedtotheerroratVCC/2.Beforecomponentvaluescanbeassigned,thetimeintervalwhichthecomparatoroutputistobesampledmustbedetermined.Theintervalbeasshortaspossibletomaximizeconverterresolutionandconversiontime.Thesamplebythetimetoexecutetherequisitecode,whichdeterminedbyclockrateofthemicrocontroller.Inthevoltmeterapplication,themicrocontrolleroperateswith12-MHzclock,resultinginaintervaloffivemicroseconds.Thetimeconstant(RC)affectstheshapeofcapacitorcharge/dischargewaveform.Thevalueofthetimeconstantmustbechosensothesteepestpartsofthewaveformareresolvabletotheresolution.Thesteepestpartofthechargeportionofthewaveformoccursneartheorigin,whilethesteepestpartthedischargenearVCC.Duethesymmetrythewaveform,thetimeconstantmaybeusedformeasurementsoneitherportionofthewaveform.Figure4showsanexpandedviewoftherelationshipbetweenvoltageandsampletimeneartheorigin.IntheVisdesiredvoltageresolutiontheconverterandisthesampledeterminedpreviously.ThecurvelabeledC’representstheltageonthecapacitor,whichappearslinearatthisscale.Inthefigure,theslopeofthecurveisideal,causingsamplingtooccurnearthecenterofthevoltageintervals.Theslopeofthecurvemaybelessthanshown,butmaynotbegreater,orresolutionwillbelost.Notethatthefirstsampleisthe

tocentertheinthefirstinterval.Toobtaintheminimumvalueofthetimeconstantwhichwillproducetherequiredslopethefirstsample,solveEquationforRC:RC=-t/1n(1-VC/VCC)(2)Thensettotheminimumdesiredresolution(0.05-volt),tosampleintervaldeterminedpreviously(fivemicroseconds),andcalculateRCatthefirstsamplepoint,whereVC=1/2

andt=1/2

:Cmin

(ln[1)/CC

2)(5(1/2)(0.05)/VCC

4.99

TheproductofthevaluesofRandCnotbelessthanthecalculatedminimumtimeconstant.Utilizingaresistorwithaonepercenttoleranceandacapacitorwithafivepercenttolerance(Rn)(C-5%)>4.99*10

Inthevoltmeterapplication,theselectedvaluesofandCare267kilohmsand2nanofarads,respectively,yieldingaminimumtimeconstantofapproximately5.02•10-4.AnadditionalconstraintplacedonthevalueR.ReferringagaintoFigure1,the5.1kilohmpullupresistorconnectedtopin11ofthemicrocontroller.Thisresistorispresenttosupplementthemicrocontroller’sweakinternalpullup,buthasthedetrimentaleffectofchangingthetimeconstanttheRCnetworkduringthechargeportionofcapacitorcharge/dischargecycle.Thisproducesanasymmetryinthecharge/dischargewaveform,whichcontributestoconversionerror.Totheeffectofdifferencesinthecapacitorchargeanddischargepaths,valueofRshouldbechosentobemuchgreaterthanthevalueofpullupresistor.Inthevoltmeterapplication,thevalueofRis267kilohms,whichexceedsthevalueofthepullupbymorethanorderofmagnitude.Thetimeconstant(RC),whichisafunctionofthedesiredconverterresolution,determinesthedurationofthecapacitorcharge/dischargecycle.Themoretimerequiredforthecapacitortochargeanddischarge,greatertheofsamplesrequiredinthemeasurementloopandthegreaternumberofentriesinthelookuptable.2.TypicalCapacitorCharge/DIschargeCycle3.CapacitorVoltageVariationasFunctionofRCVariationCtothesymmetryofthecapacitorcharge/dischargewaveform,thedeterminedsamplecountmaybeusedformeasurementsduringeitherportionoftheFromEquation3:tmax=-RmaxCmaxln(1-(1/2)VCC/VCC)=-(Rnom+1%)(Cnom+5%)ln(1/2)=-(1.01)(267103)(1.05)(2•10-9)ln(1/2)Theminimumofsamplesforhalfthecycleis:tmax/=(39310-6)/(510-6)79Tomaximizeaccuracy,fromzerotoVCC/2aremeasuredduringthechargeportionofthecapacitorcharge/dischargecycleandvoltagestoVCC/2aremeasuredduringthedischargeportionofthecycle.Asaresult,thetotalnumberofentriesinthetableistwicetheofsamplescalculatedpreviouslyforeachhalfcycle.Thelookuptablecontainsapplication-specificvaluescorrespondingtothecalculatedvoltageateachForeachhalftheNthentryinthetablecorrespondstothevoltageatt=t,wheretisthesampleintervaldeterminedpreviously.Forthechargehalfcycle,thevoltageateachsampleiscalculatedbysolvingEquation1fortheelapsedsincethecapacitorbegantocharge.Forthedischargehalfthevoltageateachiscalculatedbysolvingthefollowingequationforthetimeelapsedsincethecapacitorbegantodischarge:VC=VCCe-t/RC(4)Thesizeandcontentsthetablemayapplicationtoapplicationdependingonthesampleandconversionresolution.Astheresolutionincreases,thenumberofentriesinthetablegrows.Inthevoltmeterapplication,withresolutionequalto0.05Volt,thetablecontains158entries,whichistwicethenumberofsamplesperhalfcyclecalculatedabove.Voltagescorrespondingtosamplestakenduringthechargehalfcyclearecalculatedbyreplacing’t’with’NtinEquation1,whereNrepresentssample(0-78).Bysettingtequaltothesampleintervalofmicroseconds,Rto267kilohms,Cto2nanofarads,andVCCto5.00-volts,Equation1becomes:V=5(1-e-N(.0093633))Voltagescorrespondingtotakenduringdischargehalfcyclearecalculatedbyreplacing’with’Ntinwhererepresentsthesamplenumber(0-78).Usingthesamevaluesasforthechargehalfcycle,Equation4becomes:V=5e-N(.0093633))Anabbreviatedlistofthevoltagescalculatedforthecapacitorcharge/dischargecycleisshownbelow.Theorderingofthevoltages,increasinginthefirsthalf,decreasinginthesecond,tracksvoltageoncapacitoranddefinesorderingofthetable.N0V=0.000N1V=0.047......N74V=N75V=N76V=N77V=N78V=N0V=5.000N1V=4.953......N74V=N75V=N76V=N77V=N78V=Asshownbythelist,theofsampleshalfcycleisgreaterthanrequiredtoreachthemidrangevalueofvolts.allowsfor“fast”cycleswhichovershootthenominalmidrangevaluethelastistakenineachhalfcycle.NotethatthedifferencethecalculatedvoltagesatsamplesN=0andN=1iswithinthedesiredresolutionof0.050-volt,butthedifferenceinvoltagebetweenadjacentsamplesdecreasesNincreases.Thisreflectsthenon-linearrelationshipbetweenvoltageandtimeincircuit.Thecalculatedshowninthelistarenotenteredintothelookupbutareusedtodeterminethevaluesofthetableentries.Involtmeterapplication,calculatedvoltagesaretotenthsavoltandtheresultstoredinthetableinpacked-BCDform,twodigitsperbyte.Example:tableentrycorrespondingto2.523-voltsis25hex,whichdisplaysas2.5-volts.Thevoltmeterprototypedemonstratedaccuracyof+/-onecount(0.1Volt),butaccuracyofsomewhatlessatenthofisaboutthethatcanexpectedfromtheRCprecisioncomponents,variationsincomponentvaluesmaycontributeanerrorof-volt,asshownbelow.TocalculatetheworstcaseerrorVC=2.5-volts,firstdeterminethecorrespondingtatthenominalvaluesofRandCusingEquation3:t=-RnomCnomln(1-VC/VCC)=-RnomCnom•ln(1-2.5/5.0)=-RnomCnom•ln(0.5).SubstitutefortinEquationtogetminimumVC:VCmin=VCC(1-e-t/(Rmax=VCC(1-e(RnomCnom/RmaxCmax)ln(0.5))=5(1-eln(0.5)/(1.01•1.05))≌2.399VAgain,formaximumVC:VCmax=VCC(1-e-t/(Rmin=VCC(1-e(RnomCnom/RminCmin)ln(0.5))=5(1-eln(0.5)/(0.99•0.95))≌2.607VTheresultsshowavariationof0.208-voltsat2.5-volts,worstcaseerrorof0.104-volts.Theworstconversionerrormaybefurtherreducedbyutilizingcomponentswithtightertolerances.Conversionaccuracyandlinearityarealsoaffectedbythecharacteristicsofthecapacitor.Thecapacitorusedinthevoltmeterprototypeisapolystyrenefilmtype,whichnotonlyprovidesgoodaccuracy,butanalog-to-digitalconversionusingminimizeserrorduetodielectricabsorptionandothereffects.Errorsourceswhichhavenotbeenexaminedinclude:comparatorlimitations;asymmetriesbetweenthechargeanddischargeportionsofthefailurevoltageonthecapacitortoreachgroundorVCC;variationsinVCC.Thecontributionstoconversionerrorbythesecanexpectedtoincreaseerrortosomewhatmorethanthevalueduecomponenttolerancesalone.uccessiveApproximationAnalog-to-DigitalConverterhisconversionmethodoffersresolutionandaccuracyandashortconversiontimeattheincreasedcomponentcount.uccessiveapproximation(SA)incorporatedigitalto-analogconverter(DAC),acomparatorandasuccessiveapproximationregister(SAR).ThecontrolstheconversionbyperformingasearchforthebinarycodefedtotheDAC,willproduceanmatchingthevoltagetobeconverted.ThecomparatorcomparestheDACoutputtotheunknownvoltageandreturnstheresulttotheheSARbeginsthesearchwiththemostsignificantDACbit,whichcontrolsthewidestoutputvariation,andmovestowardtheleastsignificantbit,causingtheDACoutputto“zeroin”onunknownvalue.Theresultofthetrialisthebinarycodecorrespondingtotheunknownvalue.Inaneight-bitSAconverter,onlyeightiterationsarerequiredtofindthecorrectcode,resultinginrelativelyfastconversions.Inthisapplication(Figure5),anAT89CX051microcontrollerwithanintegralanalogcomparatorperformsfunctioninsoftware,reducingthecomponentcount.TheDACselectedforapplicationisanMC1408-8,eight-bit,currentoutputtypechosenforitslowcost.Seven-andsixbitversionsareavailableastheMC1408-7andMC1408-6,respectively.MC1408series

guaranteedaccuratetowithin1/2LSBat25Catfullscaleoutputcurrentof1.992milliamps.TherelativeaccuracyoftheMC1408-8betterthan0.19%,eight-bitmonotonicityandlinearity.TheDACansettlingtimeof300nanoseconds.TheDACcontainsbinary-weighted,current-steeringswitcheswhichscaleaninputcurrentbytheappliedbinarycode.inputcurrentderivedfromanLM336-2.5precisionreferenceandaseriesresistor.ThescaledcurrentoutputisconvertedtoavoltageanLF355Boperationalamplifierwiredasacurrent-to-voltage(I/V)converter.TheopampwasselectedfortheI/Vconverterbecauseofitslowinputoffsetandhighoutputrate.ThevoltageoutputoftheI/VconverterisintotheAT89CX051comparator,whereitistotheunknownvoltage.Whentheprogrammedexceedstheunknownvoltagetheoutputofthecomparatorgoeshigh,whichisdetectedbysoftware.Asecondopamp,wiredasanon-inverting,unitygainbufferbetweentheunknownvoltagesourceandinputtotheAT89CX051comparatortoprovideisolation.TheLM336-2.5referenceprovidesnominal2.490-voltoutput(Vref).Theactualvoltagemayvaryfrom2.390-voltsto2.590-volts.ThereferencevoltageandtemperaturecoefficientmaybetrimmedusingmethodindicatedintheLM336-2.5datasheet.Thenominalvaluethecurrentreferenceresistor(Rref)connectedtopin14oftheDACis1240Ohms,yieldingareferencecurrent(Iref)2.490V/1240Ohms(Vref/Rref)=2.008milliamps.Theeight-bitbinaryappliedtotheDACscalesIrefbyfrom0/256to255/256,resultinginacurrentoutput(Io)offromzero(Iref•0/256)to2.000milliamps(Iref•255/256)fullscale.NotethatthesignoftheDACoutputcurrentisoppositethesignofthereference(input)current.Theoutputvoltageisdeterminedbymultiplyingoutput(Io)bythevalueoftheI/Vconverterresistor(Ro).Nominalscaleoutputvoltageis2.000mA•2500Ohms(IoF.S.Ro)=5.000-volts.Thecircuitdoesnotprovideadjustmentsforoffsetgain.Offsetvoltageadjustmentsshouldnotberequired,duetothelowoffsetvoltagespecificationoftheLF355BopIftheoffsetmustbeadjusted,addtheoffsettrimcircuitshownintheLF355Bdatasheet.ThegainmaybechangedbychangingthevaluetheI/Vconvertergainresistor(Ro).Theresistorconnectedtothenon-invertinginputoftheopampshouldbeofthesamevalueastheresistorforinputbiascurrentbalancing.TheOhmresistorconnectedt

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论