1、AT89C51In-CircuitProgramming出处:AtmelCorporationThisapplicationnoteillustratesthein-circuitprogrammabilityoftheAtmelAT89C51Flash-basedmicrocontroller.Guidelinesfortheadditionofin-circuitprogrammabilitytoAT89C51applicationsarepresentedalongwithanapplicationexampleandthemodificationstoitrequiredtosuppo
2、rtin-circuitprogramming.AmethodisthenshownbywhichtheAT89C51microcontrollerintheapplicationcanbereprogrammedremotely,overacommercialtelephoneline.Thecircuitrydescribedinthisapplicationnotesupportsfivevoltprogrammingonly,requiringtheuseofanAT89C51-XX-5.ThestandardAT89C51requires12voltsforprogramming.T
3、hesoftwareforthisapplicationmaybeobtainedbydownloadingfromAtmelsGeneralConsiderationsCircuitryaddedtosupportAT89C51incircuitprogrammingshouldappeartransparenttotheapplicationwhenprogrammingisnottakingplace.EA/VPPmustbeheldhighduringprogramming.Inapplicationswhichdonotutilizeexternalprogrammemory,thi
4、spinmaybepermanentlystrappedtoVCC.Applicationsutilizingexternalprogrammemoryrequirethatthispinbeheldlowduringnormaloperation.RSTmustbeheldactiveduringprogramming.Ameansmustbeprovidedforoverridingtheapplicationresetcircuit,whichtypicallyassertsRSTonlybrieflyafterpowerisapplied.PSENmustbeheldlowduring
5、programming,butmustnotbedrivenduringnormaloperation.ALE/PROGispulsedlowduringprogramming,butmustnotbedrivenduringnormaloperation.Duringprogramming,AT89C51I/Oportsareusedfortheapplicationofmodeselect,addressesanddata,possiblyrequiringthatthecontrollerbeisolatedfromtheapplicationcircuitry.Howthisisdon
6、eisapplicationdependentandwillbeaddressedhereonlyingeneralterms.PortUsedforInputDuringprogramming,thecontrollermustbeisolatedfromsignalssourcedbytheapplicationcircuitry.Abufferwiththreestateoutputsmightbeinsertedbetweentheapplicationcircuitryandthecontroller,withthebufferoutputsthree-statedwhenprogr
7、ammingisenabled.Alternately,amultiplexermightbeusedtoselectbetweensignalsources,withsignalsappliedtothecontrollerbyeithertheapplicationcircuitryortheprogrammercircuitry.PortUsedforOutputNocircuitchangesarerequirediftheapplicationcircuitrycantoleratethestatechangeswhichoccurattheportduringprogramming
8、.Ifthepriorstateoftheapplicationcircuitrymustbemaintainedduringprogramming,alatchmightbeinsertedbetweenthecontrollerandtheapplicationcircuitry.Thelatchisenabledduringprogramming,preservingthestateoftheapplicationcircuitry.AnApplicationExampleTheAT89C51applicationshowninFigure1isanimplementationofamo
9、vingdisplay.Thisapplicationwasselectedforitssimplicityandabilitytoshowgraphicallytheresultsofin-circuitreprogramming.Thetexttobedisplayedisprogrammedintothecontrolleraspartofitsfirmware,andcannotbechangedwithoutreprogrammingthedevice.Thedisplayedtextispresentedinoneoftwomodesselectedbythefour-positi
10、onDIPswitch.Inthefirstmode,onecharacteratatimeentersthedisplayfromtherightandmovesquicklytotheleftthrougheachelementofthedisplaytoitsfinalpositionintheassembledmessage.Inthesecondmode,themessagemovesthroughthedisplay,fromrighttoleft,withthedisplayactingasawindowontothemessage.Thismodeisfamiliarasthe
11、methodoftenusedindisplaysofstockprices.TheoutputconsistsoffourDL1414T,four-digit,17-segmentalphanumericdisplayswithintegraldecodersanddrivers.Thisyields16totaldisplayelements,eachcapableofdisplayingdigits0-9,theuppercasealphabet,andsomepunctuationcharacters.ThedisplayablecharactercodesareASCII20H-5F
12、H.Apower-onresetcircuitanda6-MHzcrystaloscillatorcompletetheapplication.Neitherexternalprogrammemorynorexternaldatamemoryisused.ModificationstotheApplicationtoSupportIn-CircuitProgrammingFigure2showstheapplicationmodifiedforin-circuitprogramming.Itisassumedthattheprogrammer,wheninactive,willneitherd
13、rivenorexcessivelyloadtheapplication.Sincetheapplicationdoesnotuseexternalprogrammemory,EA/VPPonthecontrollerisconnectedtoVCC.Thismeetstherequirementforprogramming.Theresetcircuithasbeenmodifiedbytheadditionoftwotransistors,whichallowRSTonthecontrollertobeforcedhighbytheprogrammer.PSENandALE/PROG,un
14、usedinthebasicapplication,areunderthedirectcontroloftheprogrammer.ProgrammingrequiresprogrammeraccesstoallofthefourAT89C51I/Oports,asdocumentedinthedatasheet.Theprogrammerisconnecteddirectlytothosecontrollerpinswhichareunusedbytheapplication,whileaccesstopinsusedbytheapplicationrequiresspecialtreatment,asexplainedinthefollowingparagraphs.Theleastsignificantfourbitsoftheaddressgeneratedbytheprogrammeraremultiplexedontoportoneofth
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1