AT89C51-In-Circuit-Programming(1)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

5-11AT89C51In-CircuitProgrammingThisapplicationnoteillustratesthein-cir-cuitprogrammabilityoftheAtmelAT89C51Flash-basedmicrocontroller.Guidelinesfortheadditionofin-circuitprogrammabilitytoAT89C51applica-tionsarepresentedalongwithanappli-cationexampleandthemodificationstoitrequiredtosupportin-circuitprogram-ming.AmethodisthenshownbywhichtheAT89C51microcontrollerintheapplicationcanbereprogrammedremotely,overacommercialtelephoneline.Thecircuitrydescribedinthisappli-cationnotesupportsfivevoltprogram-mingonly,requiringtheuseofanAT89C51-XX-5.ThestandardAT89C51requires12voltsforprogramming.ThesoftwareforthisapplicationmaybeobtainedbydownloadingfromAtmel’sBBS:(408)436-4309.GeneralConsiderationsCircuitryaddedtosupportAT89C51in-circuitprogrammingshouldappeartransparenttotheapplicationwhenpro-grammingisnottakingplace.EA/VPPmustbeheldhighduringpro-gramming.Inapplicationswhichdonotutilizeexternalprogrammemory,thispinmaybepermanentlystrappedtoVCC.Applicationsutilizingexternalprogrammemoryrequirethatthispinbeheldlowduringnormaloperation.RSTmustbeheldactiveduringpro-gramming.Ameansmustbeprovidedforoverridingtheapplicationresetcir-cuit,whichtypicallyassertsRSTonlybrieflyafterpowerisapplied.PSENmustbeheldlowduringprogram-ming,butmustnotbedrivenduringnor-maloperation.ALE/PROGispulsedlowduringpro-gramming,butmustnotbedrivenduringnormaloperation.Duringprogramming,AT89C51I/Oportsareusedfortheapplicationofmodeselect,addressesanddata,possiblyrequiringthatthecontrollerbeisolatedfromtheapplicationcircuitry.Howthisisdoneisapplicationdependentandwillbeaddressedhereonlyingeneralterms.PortUsedforInputDuringprogramming,thecontrollermustbeisolatedfromsignalssourcedbytheapplicationcircuitry.Abufferwiththree-stateoutputsmightbeinsertedbetweentheapplicationcircuitryandthecontrol-ler,withthebufferoutputsthree-statedwhenprogrammingisenabled.Alter-nately,amultiplexermightbeusedtoselectbetweensignalsources,withsig-nalsappliedtothecontrollerbyeithertheapplicationcircuitryortheprogram-mercircuitry.PortUsedforOutputNocircuitchangesarerequirediftheapplicationcircuitrycantoleratethestatechangeswhichoccurattheportduringprogramming.Ifthepriorstateoftheapplicationcircuitrymustbemaintainedduringprogramming,alatchmightbeinsertedbetweenthecontrollerandtheapplicationcircuitry.Thelatchisenabledduringprogramming,preservingthestateoftheapplicationcircuitry.AnApplicationExampleTheAT89C51applicationshowninFig-ure1isanimplementationofamovingdisplay.Thisapplicationwasselectedforitssimplicityandabilitytoshowgraphi-callytheresultsofin-circuitreprogram-ming.Thetexttobedisplayedispro-grammedintothecontrolleraspartofitsfirmware,andcannotbechangedwith-outreprogrammingthedevice.0287D-B–9/978-BitMicrocontrollerwithFlashApplicationNoteMicrocontroller5-12Thedisplayedtextispresentedinoneoftwomodesselectedbythefour-positionDIPswitch.Inthefirstmode,onecharacteratatimeentersthedisplayfromtherightandmovesquicklytotheleftthrougheachelementofthedisplaytoitsfinalpositionintheassembledmessage.Inthesecondmode,themessagemovesthroughthedisplay,fromrighttoleft,withthedisplayactingasawindowontothemessage.Thismodeisfamiliarasthemethodoftenusedindisplaysofstockprices.TheoutputconsistsoffourDL1414T,four-digit,17-seg-mentalphanumericdisplayswithintegraldecodersanddrivers.Thisyields16totaldisplayelements,eachcapableofdisplayingdigits0-9,theuppercasealphabet,andsomepunctuationcharacters.ThedisplayablecharactercodesareASCII20H-5FH.Apower-onresetcircuitanda6-MHzcrystaloscillatorcompletetheapplication.Neitherexternalprogrammemorynorexternaldatamemoryisused.ModificationstotheApplicationtoSupportIn-CircuitProgrammingFigure2showstheapplicationmodifiedforin-circuitprogramming.Itisassumedthattheprogrammer,wheninactive,willnei-therdrivenorexcessivelyloadtheapplication.Sincetheapplicationdoesnotuseexternalprogrammem-ory,EA/VPPonthecontrollerisconnectedtoVCC.Thismeetstherequirementforprogramming.Theresetcircuithasbeenmodifiedbytheadditionoftwotransistors,whichallowRSTonthecontrollertobeforcedhighbytheprogrammer.PSENandALE/PROG,unusedinthebasicapplication,areunderthedirectcontroloftheprogrammer.ProgrammingrequiresprogrammeraccesstoallofthefourAT89C51I/Oports,asdocumentedinthedatasheet.Theprogrammerisconnecteddirectlytothosecontrollerpinswhichareunusedbytheapplication,whileaccesstopinsusedbytheapplicationrequiresspecialtreatment,asexplainedinthefollowingparagraphs.Theleastsignificantfourbitsoftheaddressgeneratedbytheprogrammeraremultiplexedontoportoneofthecon-trollerwiththedatafromtheDIPswitch.Notethatthefourresistorsaddedattheswitcharenotrequiredinthebasicapplication,sincetheAT89C51providesinternalpull-upsonportone.Duringthenormaloperationoftheapplication,controllerportszeroandtwoprovidedataandcontrolsignals(respectively)tothedisplays.Duringprogrammingandpro-gramverification,theprogrammerassertscontrolofportzeroandpartofporttwo.Theprogrammerisconnectedtoportszeroandtwowithoutbuffering,since,wheninactive,itspresencedoesnotaffectthenormaloperationoftheapplication.Atransparentlatchhasbeenaddedbetweenporttwoo

1 / 11
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功