1、一、英文原文一、英文原文TheHardwareOverviewThe8051familyofmicrocontrollersisbasedonanarchitecturewhichishighlyoptimizedfembeddedontrolsystems.ItisusedinawidevarietyofapplicationsfrommilitaryequipmenttoautomobilestothekeyboardonyourP
2、C.SecondonlytotheMotola68HC11ineightbitprocessssalesthe8051familyofmicrocontrollersisavailableinawidearrayofvariationsfrommanufacturerssuchasIntelPhilipsSiemens.Thesemanufacturershaveaddednumerousfeaturesperipheralstothe
3、8051suchasI2Cinterfacesanalogtodigitalconverterswatchdogtimerspulsewidthmodulatedoutputs.Variationsofthe8051withclockspeedsupto40MHzvoltagerequirementsdownto1.5voltsareavailable.Thiswiderangeofpartsbasedononecemakesthe80
4、51familyanexcellentchoiceasthebasearchitecturefacompanysentirelineofproductssinceitcanperfmmanyfunctionsdeveloperswillonlyhavetoearnthisoneplatfm.Thebasicarchitectureconsistsofthefollowingfeatures:1、aneightbitALU2、32desc
5、reteIOpins(4groupsof8)whichcanbeindividuallyaccessed3、two16bittimercounters4、fullduplexUART.5、6interruptsourceswith2priitylevels.6、128bytesofonboardRAM.7、separate64KbyteaddressspacesfDATACODEmemy.One8051processcycleconsi
6、stsoftwelveoscillatperiods.Eachofthetwelveoscillatperiodsisusedfaspecialfunctionbythe8051cesuchasopcodefetchessamplesoftheinterruptdaisychainfpendinginterrupts.Thetimerequiredfany8051instructioncanbecomputedbydividingthe
7、clockfrequencyby12invertingthatresultmultiplyingitbythenumberofprocesscyclesrequiredbytheinstructioninquestion.Therefeifyouhaveasystemwhichisusingan11.059MHzclockyoucancomputethenumberofinstructionspersecondbydividingthi
8、svalueby12.Thisgivesaninstructionfrequencyof921583instructionspersecond.Invertingthiswillprovidetheamountoftimetakenbyeachinstructioncycle(1.085microseconds).MemyganizationThe8051architectureprovidestheuserwiththreephysi
9、callydistinctmemyspaceswhichcanbeseeninFigureA1.EachmemyspaceconsistsofcontiguousThesecondmemyspaceisthe128bytesofinternalRAMonthe8051thefirst128bytesofinternalRAMonthe8052.ThissegmentistypicallyreferredtoastheDATAsegmen
10、t.TheRAMlocationsinthissegmentareaccessedinonetwocyclesdependingontheinstruction.ThisaccesstimeismuchquickerthanaccesstotheXDATAsegmentbecausememyisaddresseddirectlyratherthanviaamemypointersuchasDPTRwhichmustfirstbeinit
11、ialized.TherefefrequentlyusedvariablestemparyscratchvariablesareusuallyassignedtotheDATAsegment.Suchallocationmustbedonewithcarehoweverduetothelimitedamountofmemyinthissegment.VariablesstedintheDATAsegmentcanalsobeaccess
12、edindirectlyviaR0R1.Theregisterbeingusedasthememypointermustcontaintheaddressofthebytetoberetrievedaltered.Theseinstructionscantakeonetwoprocesscyclesdependingonthesourcedestinationdatabyte.TheDATAsegmentcontainstwosmall
13、ersegmentsofinterest.Thefirstsubsegmentconsistsofthefoursetsofregisterbankswhichcomposethefirst32bytesofRAM.The8051canuseanyofthesefourgroupsofeightbytesasitsdefaultregisterbank.Theionofregisterbanksischangeableatanytime
14、viatheRS1theRS0bitsintheProcessStatusWd(PSW).Thesetwobitscombineintoanumberfrom0to3(withRS1beingthemostsignificantbit)whichindicatestheregisterbanktobeused.Registerbankswitchingallowsnotonlyfquickparameterpassingbutalsoo
15、pensthedofsimplifyingtaskswitchingonthe8051.ThesecondsubsegmentintheDATAspaceisabitaddressablesegmentinwhicheachbitcanbeindividuallyaccessed.ThissegmentisreferredtoastheBDATAsegment.Thebitaddressablesegmentconsistsof16by
16、tes(128bits)abovethefourregisterbanksinmemy.The8051containsseveralsinglebitinstructionswhichareoftenveryusefulincontrolapplicationsaidinreplacingexternalcombinatiallogicwithsoftwareinthe8051thusreducingpartscountonthetar
17、getsystem.Itshouldbenotedthatthese16bytescanalsobeaccessedona“bytewide“basisjustlikeanyotherbyteintheDATAspace.SpecialFunctionRegistersControlregistersftheinterruptsystemtheperipheralsonthe8051arecontainedininternalRAMat
18、locations80hexabove.Theseregistersarereferredtoasspecialfunctionregisters(SFRsfsht).Manyofthemarebitaddressable.ThebitsinthebitaddressableSFRscaneitherbeaccessedbynameindexbitaddress.ThusyoucanrefertotheEAbitoftheInterru
19、ptEnableSFRasEAIE.70AFH.TheSFRscontrolthingssuchasthefunctionofthetimercounterstheUARTtheinterruptsourcesaswellastheirpriities.TheseregistersareaccessedbythesamesetofinstructionsasthebytesbitsintheDATAsegment.Amemymapoft