版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
自动售货机毕业论文PAGE28PAGE29中英文资料对照外文翻译附录A:IntroduceofAT89C20511DescriptioncommonlyDescriptionTheAT89C2051isalow-voltage,high-performanceCMOS8-bitmicrocomputerwith2KbytesofFlashprogrammableanderasablereadonlymemory(PEROM).ThedeviceismanufacturedusingAtmel’shigh-densitynonvolatilememorytechnologyandiscompatiblewiththeindustry-standardMCS-51instructionset.Bycombiningaversatile8-bitCPUwithFlashonamonolithicchip,theAtmelAT89C2051isapowerfulmicrocomputerwhichprovidesahighly-flexibleandcost-effectivesolutiontomanyembeddedcontrolapplications.TheAT89C2051providesthefollowingstandardfeatures:2KbytesofFlash,128bytesofRAM,15I/Olines,two16-bittimer/counters,afivevectortwo-levelinterruptarchitecture,afullduplexserialport,aprecisionanalogcomparator,on-chiposcillatorandclockcircuitry.Inaddition,theAT89C2051isdesignedwithstaticlogicforoperationdowntozerofrequencyandsupportstwosoftwareselectablepowersavingmodes.TheIdleModestopstheCPUwhileallowingtheRAM,timer/counters,serialportandinterruptsystemtocontinuefunctioning.Thepower-downmodesavestheRAMcontentsbutfreezestheoscillatordisablingallotherchipfunctionsuntilthenexthardwarereset.1.2Features•CompatiblewithMCS-51™Products•2KBytesofReprogrammableFlashMemory–Endurance:1,000Write/EraseCycles•0Vto6VOperatingRange•FullyStaticOperation:0Hzto24MHz•Two-levelProgramMemoryLock•128x8-bitInternalRAM•15ProgrammableI/OLines•Two16-bitTimer/Counters•SixInterruptSources•ProgrammableSerialUARTChannel•DirectLEDDriveOutputs•On-chipAnalogComparator•Low-powerIdleandPower-downModespinconfiguration1.4PinDescriptionVCCSupplyvoltage.GNDGround.Port1Port1isan8-bitbi-irectionalI/Oport.PortpinsP1.2toP1.7provideinternalpullups.P1.0andP1.1requireexternalpullups.P1.0andP1.1alsoserveasthepositiveinput(AIN0)andthenegativeinput(AIN1),respectively,oftheon-chipprecisionanalogcomparator.ThePort1outputbufferscansink20mAandcandriveLEDdisplaysdirectly.When1sarewrittentoPort1pins,theycanbeusedasinputs.WhenpinsP1.2toP1.7areusedasinputsandareexternallypulledlow,theywillsourcecurrent(IIL)becauseoftheinternalpullups.Port1alsoreceivescodedataduringFlashprogrammingandverification.Port3Port3pinsP3.0toP3.5,P3.7aresevenbi-irectionalI/Opinswithinternalpullups.P3.6ishard-wiredasaninputtotheoutputoftheon-chipcomparatorandisnotaccessibleasageneralpurposeI/Opin.ThePort3outputbufferscansink20mA.When1sarewrittentoPort3pinstheyarepulledhighbytheinternalpullupsandcanbeusedasinputs.Asinputs,Port3pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseofthepullups.Port3alsoservesthefunctionsofvariousspecialfeaturesoftheAT89C2051aslistedbelow:Port3alsoreceivessomecontrolsignalsforFlashprogrammingandverification.RSTResetinput.AllI/Opinsareresetto1sassoonasRSTgoeshigh.HoldingtheRSTpinhighfortwomachinecycleswhiletheoscillatorisrunningresetsthedevice.VCCSupplyvoltage.GNDGround.Eachmachinecycletakes12oscillatororclockcycles.XTAL1Inputtotheinvertingoscillatoramplifierandinputtotheinternalclockoperatingcircuit.XTAL2Outputfromtheinvertingoscillatoramplifier.1.5OscillatorCharacteristicsXTAL1andXTAL2aretheinputandoutput,respectively,ofaninvertingamplifierwhichcanbeconfiguredforuseasanon-chiposcillator,asshowninFigure1.Eitheraquartzcrystalorceramicresonatormaybeused.Todrivethedevicefromanexternalclocksource,XTAL2shouldbeleftunconnectedwhileXTAL1isdrivenasshowninFigure2.Therearenorequirementsonthedutycycleoftheexternalclocksignal,sincetheinputtotheinternalclockingcircuitryisthroughadivide-by-twoflip-flop,butminimumandmaximumvoltagehighandlowtimespecificationsmustbeobserved.2RestrictionsonCertainInstructionsTheAT89C2051andisaneconomicalandcost-effectivememberofAtmel’sgrowingfamilyofmicrocontrollers.Itcontains2Kbytesofflashprogrammemory.ItisfullycompatiblewiththeMCS-51architecture,andcanbeprogrammedusingtheMCS-51instructionset.However,thereareafewconsiderationsonemustkeepinmindwhenutilizingcertaininstructionstoprogramthisdevice.Alltheinstructionsrelatedtojumpingorbranchingshouldberestrictedsuchthatthedestinationaddressfallswithinthephysicalprogrammemoryspaceofthedevice,whichis2KfortheAT89C2051.Thisshouldbetheresponsibilityofthesoftwareprogrammer.Forexample,LJMP7E0HwouldbeavalidinstructionfortheAT89C2051(with2Kofmemory),whereasLJMP900Hwouldnot.2.1Branchinginstructions:LCALL,LJMP,ACALL,AJMP,SJMP,JMP@A+DPTRTheseunconditionalbranchinginstructionswillexecutecorrectlyaslongastheprogrammerkeepsinmindthatthedestinationbranchingaddressmustfallwithinthephysicalboundariesoftheprogrammemorysize(locations00H7FFHforthe89C2051).Violatingthephysicalspacelimitsmaycauseunknownprogrambehavior.CJNE[...],DJNZ[...],JB,JNB,JC,JNC,JBC,JZ,JNZWiththeseconditionalbranchinginstructionsthesameruleaboveapplies.Again,violatingthememoryboundariesmaycauseerraticexecution.Forapplicationsinvolvinginterruptsthenormalinterruptserviceroutineaddresslocationsofthe80C51familyarchitecturehavebeenpreserved.2.2MOVX-relatedinstructions,DataMemory:TheAT89C2051contains128bytesofinternaldatamemory.Thus,intheAT89C2051thestackdepthislimitedto128bytes,theamountofavailableRAM.ExternalDATAmemoryaccessisnotsupportedinthisdevice,norisexternalPROGRAMmemoryexecution.Therefore,noMOVX[...]instructionsshouldbeincludedintheprogram.Atypical80C51assemblerwillstillassembleinstructions,eveniftheyarewritteninviolationoftherestrictionsmentionedabove.Itistheresponsibilityofthecontrollerusertoknowthephysicalfeaturesandlimitationsofthedevicebeingusedandadjusttheinstructionsusedcorrespondingly.2.3ProgramMemoryLockBitsOnthechiparetwolockbitswhichcanbeleftunprogrammed(U)orcanbeprogrammed(P)toobtaintheadditionalfeatureslistedinthetablebelow:3TowmodeIdleModeandPowerDownMode3.1IdleModeInidlemode,theCPUputsitselftosleepwhilealltheonchipperipheralsremainactive.Themodeisinvokedbysoftware.Thecontentoftheon-chipRAMandallthespecialfunctionsregistersremainunchangedduringthismode.Theidlemodecanbeterminatedbyanyenabledinterruptorbyahardwarereset.P1.0andP1.1shouldbesetto“0”ifnoexternalpullupsareused,orsetto“1”ifexternalpullupsareused.Itshouldbenotedthatwhenidleisterminatedbyahardwarereset,thedevicenormallyresumesprogramexecution,fromwhereitleftoff,uptotwomachinecyclesbeforetheinternalresetalgorithmtakescontrol.On-chiphardwareinhibitsaccesstointernalRAMinthisevent,butaccesstotheportpinsisnotinhibited.ToeliminatethepossibilityofanunexpectedwritetoaportpinwhenIdleisterminatedbyreset,theinstructionfollowingtheonethatinvokesIdleshouldnotbeonethatwritestoaportpinortoexternalmemory.3.2Power-downModeInthepowerdownmodetheoscillatorisstopped,andtheinstructionthatinvokespowerdownisthelastinstructionexecuted.Theon-chipRAMandSpecialFunctionRegistersretaintheirvaluesuntilthepowerdownmodeisterminated.Theonlyexitfrompowerdownisahardwarereset.ResetredefinestheSFRbutdoesnotchangetheon-chipRAM.TheresetshouldnotbeactivatedbeforeVCCisrestoredtoitsnormaloperatinglevelandmustbeheldactivelongenoughtoallowtheoscillatortorestartandstabilize.4ProgrammingTheFlashTheAT89C2051isshippedwiththe2Kbytesofon-chipPEROMcodememoryarrayintheerasedstate(i.e.,contents=FFH)andreadytobeprogrammed.Thecodememoryarrayisprogrammedonebyteatatime.Oncethearrayisprogrammed,tore-programanynon-blankbyte,theentirememoryarrayneedstobeerasedelectrically.thenextcyclemaybegin.DataPollingmaybeginanytimeafterawritecyclehasbeeninitiated.4.1InternalAddressCounterTheAT89C2051containsaninternalPEROMaddresscounterwhichisalwaysresetto000HontherisingedgeofRSTandisadvancedbyapplyingapositivegoingpulsetopinXTAL1.4.2ProgrammingAlgorithmToprogramtheAT89C2051,thefollowingsequenceisrecommended.(1).Power-upsequence:ApplypowerbetweenVCCandGNDpinsSetRSTandXTAL1toGND(2).SetpinRSTto“H”SetpinP3.2to“H”(3).Applytheappropriatecombinationof“H”or“L”logiclevelstopinsP3.3,P3.4,P3.5,P3.7toselectoneoftheprogrammingoperationsshowninthePEROMProgrammingModestable.ToProgramandVerifytheArray:(4).ApplydataforCodebyteatlocation000HtoP1.0toP1.7.(5).RaiseRSTto12Vtoenableprogramming.(6).PulseP3.2oncetoprogramabyteinthePEROMarrayorthelockbits.Thebyte-writecycleisself-timedandtypicallytakes1.2ms.(7).Toverifytheprogrammeddata,lowerRSTfrom12Vtologic“H”levelandsetpinsP3.3toP3.7totheappropiatelevels.OutputdatacanbereadattheportP1pins.(8).Toprogramabyteatthenextaddresslocation,pulseXTAL1pinoncetoadvancetheinternaladdresscounter.ApplynewdatatotheportP1pins.(9).Repeatsteps5through8,changingdataandadvancingtheaddresscounterfortheentire2Kbytesarrayoruntiltheendoftheobjectfileisreached.10.Power-offsequence:setXTAL1to“L”setRSTto“L”TurnVCCpoweroff4.3DataPollingTheAT89C2051featuresDataPollingtoindicatetheendofawritecycle.Duringawritecycle,anattemptedreadofthelastbytewrittenwillresultinthecomplementofthewrittendataonP1.7.Oncethewritecyclehasbeencompleted,truedataisvalidonalloutputs,andthenextcyclemaybegin.DataPollingmaybeginanytimeafterawritecyclehasbeeninitiated.4.4ProgramVerifyIflockbitsLB1andLB2havenotbeenprogrammedcodedatacanbereadbackviathedatalinesforverification:1.Resettheinternaladdresscounterto000HbybringingRSTfrom“L”to“H”.2.ApplytheappropriatecontrolsignalsforReadCodedataandreadtheoutputdataattheportP1pins.3.PulsepinXTAL1oncetoadvancetheinternaladdresscounter.4.ReadthenextcodedatabyteattheportP1pins.5.Repeatsteps3and4untiltheentirearrayisread.4.5ReadingtheSignatureBytesThesignaturebytesarereadbythesameprocedureasanormalverificationoflocations000H,001H,and002H,exceptthatP3.5andP3.7mustbepulledtoalogiclow.Thevaluesreturnedareasfollows.(000H)=1EHindicatesmanufacturedbyAtmel(001H)=21Hindicates89C2051附录B:AT89C2051介绍1概述1.1功能特性概述AT89C2051是一个有2k字节可编程EPROM的高性能的微控制器。本器件与工业标准MCS-51TM的指令组和引脚兼容。ATMEL半导体公司的AT89C2051是一种功能强大的微控制器,它对很多嵌入式控制应用提供了一个高度灵活的有效的解决方案。AT89C2051有以下特点:2k字节EPROM、128字节RAM、15根I/O线、二个16位定时/计数器、五个向量二级的中断结构、一个全双向的串行口、一个精密的模拟比较器、片内振荡器和时钟电路。此外,AT89C2051支持二种软件可选的电源节约方式。空闲方式停止CPU而让RAM、定时/计数器、串行口和中断系统继续有效。掉电方式保存RAM的内容但振荡器停振以禁止芯片所有的其它功能直到下一次硬件复位。1.2主要性能参数与MCS-51TM产品兼容2k字节可编程EPROM1000次写周期※2.7V至6V电压工作范围※0MHz/24MHz工作频率※具有加密阵列的二级程序存储器加锁※128字节SRAM※15根可编程I/O线※二个16位定时/计数器※可编程的串行USART※五个中断源※输出可直接驱动LED※片内模拟比较器※低功耗空闲和掉电方式1.3引脚配置1.4引脚说明Vcc电源电压。GND地。Port1口1是一个8位双向I/O口。口引脚P1.2至P1.7提供内部上拉。P1.0和P1.1需要外部上拉。P1.0和P1.1也可以分别用作片内精密模拟比较器的正输入端(AIN0)和负输入端(AIN1)。口1的输出缓冲器能吸入20mA电流并能直接驱动LED显示。当“1”引脚时,它们可被用作输入脚。当引脚P1.2至P1.7被用作输入并被外部拉低时,由于内部上拉它们将供出电流(IIL)。当EPROM编程时和编程检验时Port1也接收代码数据。Port3口3的引脚P3.0至P3.5、P3.7是7个带有内部上拉的双向I/O引脚。P3.6是片内比较器的输出脚而不能作为普通的I/O脚访问。Port3的输出缓冲器可吸入20mA。当“1”写入Port3引脚时,它们被内部的上拉拉高并被用作输入。作为输入口,被外部拉低的Port3引脚将因为上拉而供出电流(TIL)。Port3也能用作如下表所列AT89C2051的各种特殊功能:引脚引脚功能P3.0RXD(串行输入口)P3.1TXD(串行输出口)P3.2INT0(外部中断0)P3.3INT1(外部中断1)P3.4T0(定时器0外部输入端)P3.5T1(定时器1外部输入端)Port3在EPROM编程时和编程检验时也接收某些控制信号。RST复位输入。只要RST一变高,所有的I/O引脚都复位为“1”。在振荡器工作时,保持RST脚为高电位经二个机器周期,器件即复位。这个引脚在EPROM编程时,也接收12.75V编程电源电压(Vpp)。XTAL1反相振荡器的放大器输入端和内部时钟工作电路的输入端。XTAL2反相振荡器的放大器输出端。1.5推荐的振荡器电路XTAL1和XTAL2各为内部放大器的输入和输出端,如下图所示意的那样。可采用石英晶体或陶瓷震荡器组成时钟震荡器,如需从外部输入时钟驱动AT89C2051,时钟信号从XTAL1输入,XTAL2应悬空。由于输入到内部电路是经过一个2分频触发器,所以输入的外部时钟信号无需特殊要求,但它必须符合电平的最大和最小及时序规范。石英晶体时:C1,C2=30pF+(—石英晶体时:C1,C2=30pF+(—)10pF陶瓷滤波器:C1,C2=40pF+(—)10pF内部震荡电路图22关于某些指令的限制AT89C2051是AT89C2051是经济型低价位的控制器,它有2k字节的Flash闪存程序存储器。它与MCS-51结构完全兼容,并能用MCS-51指令组编程。但是当利用某些指令来对此器件编程时,有少数是必须考虑的。和跳转或分支有关的指令有一定的空间约束,使目的地址能安全落在AT89C2051的2K字节的物理程存储器空间内,程序员必须注意这一点。对于2K字字存储器的AT89C2051来说,LJMP7E0H是一条有效指令,而LJMP900H则为无效指令2.1分支指令对于LCALL、LJMP、ACALL、AJMP、SJMP、JMP@A+DPTR这些无条件分支指令只有在编程者注意到分支的目的地址必须落在程序存储器的物理边界之内对AT89C2051地址是000H至7FFH)才能正确地执行。违反物理空间限制将引起不知道的程序运行情况。CJNE[.]、DJNZ[.]、JB、JNB、JC、JNC、JBC、JZ、JNZ对这些条件分支指令也适用上述同样的规则。超出存储器边界将引起错误的执行。对涉及中断的应用,80C51规定的中断服务子程序的地址位都已经保存。2.2与MOVX有关的指令,数据存储器AT89C2051有128字节内部数据存储器。这样,在AT89C20511中堆栈深度被限制为128字节,即所有RAM的数量。该器件不支持外部DATA存储器的访问,也不支持外部程序存储器的执行。所以,程序中不能包含MOVX指令。一个典型的80C51汇编器仍可用来汇编指令,即使它们违反了上面所说的限制。控制器用户的责任是知道所用器件的物理特点和限制并相应地调整所用的指令。2.3程序存储器的加密AT89C2051可使用对于芯片上的两个加密进行编程(P)或不编程(U)来得到如下表的功能:程序加密位LB1LB2保护类型1UU无程序加密功能2PU禁止进一步进行FLASH闪速编程3PP同方式2同时禁止效验3省电方式有两种省电方式可供使用,即空闲方式(IdleMode)和掉电方式(PowerDownMode)。3.1空闲方式在空闲方式,CPU让自己睡眠而所有片内的外围都保持激活。这种方式由软件调用。在本方式时片内RAM和所有的特殊功能寄存器的内容都不改变。空闲方式可由任何使能的中断或一次硬件复位来终止。如果不使用外部上拉则P1.0和P1.1必须被置为“0”,如果使用外部上拉则置为“1”。当空闲方式由一次硬件复位终止时,必须注意,这时器件通常要恢复程序的执行,在内部的复位规则起作用以前,它要停止等待两个机器周期。在这时,片内硬件禁止访问内部RAM,但不禁止访问端口引脚。当空闲方式由复位终止时,为了消除对端口引脚不希望的写入的可能性,在调用空闲方式指令后面的指令必须不是向端口引脚或外部存储器写入的指令。3.2掉电方式在掉电模式下,震荡器停止工作,进入掉电模式的指令是最后一条被执行的指令,片内RAM和特殊功能寄存器的内容在终止掉电模式前被冻结。退
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年度租赁合同的租赁物维修义务3篇
- 设备拆除工程合同范例
- 油漆代理销售合同范例
- 2024年度仓储物流基地租赁及运营管理合同2篇
- 2024年度厦门融资租赁合同7篇
- 2024年度企业级云计算服务平台设计与建设合同3篇
- 工业叉车租赁服务合同范例
- 姑苏区工程合同范例
- 饮用水检测合同范例
- 2024年度苏晓离婚协议书:关于配偶名下股票及证券资产的分配2篇
- 肺源性及肺外源性课件
- 医护人员法律法规宣传课件
- 最新公开课立定跳远;喂鸭子
- 电子政务概论课件
- 高分子材料性能测试力学性能课件
- 工笔画古典中国风通用PPT模板
- ecmo中的抗凝学习
- 毕业证明书个人申请书模板七篇
- 关注中学生心理健康主题班会课件
- 2022年秋新苏教版四年级上册科学全册教案
- 医药专业化学术推广浅析
评论
0/150
提交评论