89S52系列微控制器中英文對照外文翻譯文獻_第1頁
89S52系列微控制器中英文對照外文翻譯文獻_第2頁
89S52系列微控制器中英文對照外文翻譯文獻_第3頁
89S52系列微控制器中英文對照外文翻譯文獻_第4頁
89S52系列微控制器中英文對照外文翻譯文獻_第5頁
已閱讀5頁,還剩14頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

中英文對照外文翻譯文獻(文檔含英文原文和中文翻譯)89S52seriesmicrocontrollerThe89S52familyofmicrocontrollersisbasedonanarchitecturewhichishighlyoptimizedforembeddedcontrolsystems.ItisusedinawidevarietyofapplicationsfrommilitaryequipmenttoautomobilestothekeyboardonyourPC.SecondonlytotheMotorola68HC11ineightbitprocessorssales,the89S52familyofmicrocontrollersisavailableinawidearrayofvariationsfrommanufacturerssuchasIntel,Philips,andSiemens.Thesemanufacturershaveaddednumerousfeaturesandperipheralstothe89S52suchasI2Cinterfaces,analogtodigitalconverters,watchdogtimers,andpulsewidthmodulatedoutputs.Variationsofthe89S52withclockspeedsupto40MHzandvoltagerequirementsdownto1.5voltsareavailable.Thiswiderangeofpartsbasedononecoremakesthe89S52familyanexcellentchoiceasthebasearchitectureforacompany'sentirelineofproductssinceitcanperformmanyfunctionsanddeveloperswillonlyhavetolearnthisoneplatform.Thebasicarchitectureconsistsofthefollowingfeatures:1.aneightbitALU2.32descreteI/Opins(4groupsof8)whichcanbeindividuallyaccessed3.two16bittimer/counters4.fullduplexUART5.6interruptsourceswith2prioritylevels6.128bytesofonboardRAM7.separate64KbyteaddressspacesforDATAandCODEmemoryOne89S52processorcycleconsistsoftwelveoscillatorperiods.Eachofthetwelveoscillatorperiodsisusedforaspecialfunctionbythe89S52coresuchasopcodefetchesandsamplesoftheinterruptdaisychainforpendinginterrupts.Thetimerequiredforany89S52instructioncanbecomputedbydividingtheclockfrequencyby12,invertingthatresultandmultiplyingitbythenumberofprocessorcyclesrequiredbytheinstructioninquestion.Therefore,ifyouhaveasystemwhichisusingan11.059MHzclock,youcancomputethenumberofinstructionspersecondbydividingthisvalueby12.Thisgivesaninstructionfrequencyof921583instructionspersecond.Invertingthiswillprovidetheamountoftimetakenbyeachinstructioncycle(1.085microseconds).1.MemoryOrganizationThe89S52architectureprovidestheuserwiththreephysicallydistinctmemoryspaceswhichcanbeseeninFigureA-1.Eachmemoryspaceconsistsofcontiguousaddressesfrom0tothemaximumsize,inbytes,ofthememoryspace.Addressoverlapsareresolvedbyutilizinginstructionswhichreferspecificallytoagivenaddressspace.Thethreememoryspacesfunctionasdescribedbelow.2.TheCODESpaceThefirstmemoryspaceistheCODEsegmentinwhichtheexecutableprogramresides.Thissegmentcanbeupto64K(sinceitisaddressedby16addresslines).TheprocessortreatsthissegmentasreadonlyandwillgeneratesignalsappropriatetoaccessamemorydevicesuchasanEPROM.However,thisdoesnotmeanthattheCODEsegmentmustbeimplementedusinganEPROM.ManyembeddedsystemsthesedaysareusingEEPROMwhichallowsthememorytobeoverwritteneitherbythe89S52itselforbyanexternaldevice.ThismakesupgradestotheproducteasytodosincenewsoftwarecanbedownloadedintotheEEPROMratherthanhavingtodisassembleitandinstallanewEPROM.Additionally,batterybackedSRAMcanbeusedinplaceofanEPROM.ThismethodoffersthesamecapabilitytouploadnewsoftwaretotheunitasdoesanEEPROM,anddoesnothaveanysortofread/writecyclelimitationssuchasanEEPROMhas.However,whenthebatterysupplyingtheRAMeventuallydies,sodoesthesoftwareinit.UsinganSRAMinplaceofanEPROMindevelopmentsystemsallowsforrapiddownloadingofnewcodeintothetargetsystem.Whenthiscanbedone,ithelpsavoidthecycleofprogramming/testing/erasingwithEPROM,andcanalsohelpavoidhasslesoveranincircuitemulatorwhichisusuallyararecommodity.Inadditiontoexecutablecode,itiscommonpracticewiththe89S52tostorefixedlookuptablesintheCODEsegment.Tofacilitatethis,the89S52providesinstructionswhichallowrapidaccesstotablesviathedatapointer(DPTR)ortheprogramcounterwithanoffsetintothetableoptionallyprovidedbytheaccumulator.Thismeansthatoftentimes,atable'sbaseaddresscanbeloadedinDPTRandtheelementofthetabletoaccesscanbeheldintheaccumulator.Theadditionisperformedbythe89S52duringtheexecutionoftheinstructionwhichcansavemanycyclesdependingonthesituation.Anexampleofthisisshownlaterinthischapterin.3.TheDATASpaceThesecondmemoryspaceisthe128bytesofinternalRAMonthe89S52,orthefirst128bytesofinternalRAMonthe89S52.ThissegmentistypicallyreferredtoastheDATAsegment.TheRAMlocationsinthissegmentareaccessedinoneortwocyclesdependingontheinstruction.ThisaccesstimeismuchquickerthanaccesstotheXDATAsegmentbecausememoryisaddresseddirectlyratherthanviaamemorypointersuchasDPTRwhichmustfirstbeinitialized.Therefore,frequentlyusedvariablesandtemporaryscratchvariablesareusuallyassignedtotheDATAsegment.Suchallocationmustbedonewithcare,however,duetothelimitedamountofmemoryinthissegment.VariablesstoredintheDATAsegmentcanalsobeaccessedindirectlyviaR0orR1.Theregisterbeingusedasthememorypointermustcontaintheaddressofthebytetoberetrievedoraltered.Theseinstructionscantakeoneortwoprocessorcyclesdependingonthesource/destinationdatabyte.TheDATAsegmentcontainstwosmallersegmentsofinterest.Thefirstsubsegmentconsistsofthefoursetsofregisterbankswhichcomposethefirst32bytesofRAM.The89S52canuseanyofthesefourgroupsofeightbytesasitsdefaultregisterbank.TheselectionofregisterbanksischangeableatanytimeviatheRS1andtheRS0bitsintheProcessorStatusWord(PSW).Thesetwobitscombineintoanumberfrom0to3(withRS1beingthemostsignificantbit)whichindicatestheregisterbanktobeused.Registerbankswitchingallowsnotonlyforquickparameterpassing,butalsoopensthedoorforsimplifyingtaskswitchingonthe89S52Thesecondsub-segmentintheDATAspaceisabitaddressablesegmentinwhicheachbitcanbeindividuallyaccessed.ThissegmentisreferredtoastheBDATAsegment.Thebitaddressablesegmentconsistsof16bytes(128bits)abovethefourregisterbanksinmemory.The89S52containsseveralsinglebitinstructionswhichareoftenveryusefulincontrolapplicationsandaidinreplacingexternalcombinatoriallogicwithsoftwareinthe89S52thusreducingpartscountonthetargetsystem.Itshouldbenotedthatthese16bytescanalsobeaccessedona"byte-wide"basisjustlikeanyotherbyteintheDATAspace.4.SpecialFunctionRegistersControlregistersfortheinterruptsystemandtheperipheralsonthe89S52arecontainedininternalRAMatlocations80hexandabove.Theseregistersarereferredtoasspecialfunction.Registers(orSFRforshort).Manyofthemarebitaddressable.ThebitsinthebitaddressableSFRcaneitherbeaccessedbyname,indexorbitaddress.Thus,youcanrefertotheEAbitoftheInterruptEnableSFRasEA,IE.7,or0AFH.TheSFRcontrolthingssuchasthefunctionofthetimer/counters,theUART,andtheinterruptsourcesaswellastheirpriorities.TheseregistersareaccessedbythesamesetofinstructionsasthebytesandbitsintheDATAsegment.AmemorymapoftheSFRSindicatingtheregisters.5.TheIDATASpaceCertain89S52familymemberssuchasthe89S52containanadditional128bytesofinternalRAMwhichresideatRAMlocations80hexandabove.ThissegmentofRAMistypicallyreferredtoastheIDATAsegment.BecausetheIDATAaddressesandtheSFRaddressesoverlap,addressconflictsbetweenIDATARAMandtheSFRsareresolvedbythetypeofmemoryaccessbeingperformed,sincetheIDATAsegmentcanonlybeaccessedviaindirectaddressingmodes.6.TheXDATASpace.Thefinal89S52memoryspaceis64Kinlengthandisaddressedbythesame16addresslinesastheCODEsegment.Thisspaceistypicallyreferredtoastheexternaldatamemoryspace(ortheXDATAsegmentforshort).ThissegmentusuallyconsistsofsomesortofRAM(usuallyanSRAM)andtheI/Odevicesorexternalperipheralstowhichthe89S52mustinterfaceviaitsbus.ReadorwriteoperationstothissegmenttakeaminimumoftwoprocessorcyclesandareperformedusingeitherDPTR,R0,orR1.InthecaseofDPTR,itusuallytakestwoprocessorcyclesormoretoloadthedesiredaddressinadditiontothetwocyclesrequiredtoperformthereadorwriteoperation.Similarly,loadingR0orR1willtakeminimumofonecycleinadditiontothetwocyclesimposedbythememoryaccessitself.Therefore,itiseasytoseethatatypicaloperationwiththeXDATAsegmentwill,ingeneral,takeaminimumofthreeprocessorcycles.Becauseofthis,theDATAsegmentisaveryattractiveplacetostoreanyfrequently.Itispossibletofillthissegmententirelywith64KofRAMifthe89S52doesnotneedtoperformanyI/OwithdevicesinitsbusorifthedesignerwishestocycletheRAMonandoffwhenI/Odevicesarebeingaccessedviathebus.Methodsforperformingthistechniquewillbediscussedinchapterslaterinthisbook.7.On-BoardTimer/CountersThestandard89S52hastwotimer/counters(other89S52familymembershavevaryingamounts),eachofwhichisafull16bits.Eachtimer/countercanbefunctionasafreerunningtimer(inwhichcasetheycountprocessorcycles)orcanbeusedtocountfallingedgesonthesignalappliedtotheirrespectiveI/Opin(eitherT0orT1).Whenusedasacounter,theinputsignalmusthaveafrequencyequaltoorlowerthantheinstructioncyclefrequencydividedby2(ie:theoscillatorfrequency/24)sincetheincomingsignalissampledeveryinstructioncycle,andthecounterisincrementedonlywhena1to0transitionisdetected(whichwillrequiretwosamples).Ifdesired,thetimer/counterscanforceasoftwareinterruptwhentheyoverflow.TheTCON(TimerControl)SFRisusedtostartorstopthetimersaswellasholdtheoverflowflagsofthetimers.TheTCONSFRisdetailedbelowinTableA-7.Thetimer/countersarestartedorstoppedbychangingthetimerrunbits(TR0andTR1)inTCON.ThesoftwarecanfreezetheoperationofeithertimeraswellasrestartthetimerssimplybychangingtheTrxbitintheTCONregister.TheTCONregisteralsocontainstheoverflowflagsforthetimers.Whenthetimersoverflow,theysettheirrespectiveflag(TF0orTF1)inthisregister.Whentheprocessordetectsa0to1transitionintheflag,aninterruptoccursifitisenabled.Itshouldbenotedthatthesoftwarecansetorclearthisflagatanytime.Therefore,aninterruptcanbepreventedaswellasforcedbythesoftware.8.MicrocomputerinterfaceAmicrocomputerinterfaceconvertsinformationbetweentwoforms.Outsidethemicrocomputertheinformationhandledbyanelectronicsystemexistsasaphysicalsignals,butwithintheprogram,itisrepresentednumerically.Thefunctionofanyinterfacecanbebrokendownintoanumberofoperationswhichmodifythedatainsomeway,sothantheprocessofconversionbetweentheexternalandinternalformsiscarriedoutinanumberorsteps.ThiscanbeillustratedbymeansofanexamplesuchasthanorFig10-1,whichshowsaninterfacebetweenamicrocomputerandatransducerproducingacontinuouslyvariableanalogsignal.transducersoftenproduceverysmalloutrequiringamplyfrication,ortheymaygeneratesignals.inaformthatneedstobeconvertedagainbeforebeinghandledbytherestofthesystem.Forexample,manytransducersthesevariableresistancewhichmustbeconvertedtoavoltagebyaspecialcircuit.Thisprocessofconvertingthetransduceroutputintoavoltage4signalwhichcanbeconnectedtotherestofthesystemiscalledsignalconditioning.IntheexampleofFigure10-1,thesigmaconditioningsectiontranslatestherangelfvoltageorcurrentsignalsfromthetransducertoonewhichcanbeconvertedtodigitalforumbyananalog-to-digitalconverter.TransducerADCSignalconditioningTransducerADCSignalconditioningI/OSectionI/OSectionFig10-1outputInterfaceAnalog-to-digital–digitalconverter(ADC)isusedtoconvertacontinuouslyvariablesignaltoacorrespondingdigitalforumwhichcantakeanyoneofafixednumberofpossiblebinaryvalues.Iftheoutputlfthetransducerdoesnotvarycontinuously,noADCisnecessary.Inthiscasethesignalconditioningsectionmustconverttheincomingsignaltoaformwhichcanbeconnecteddirectlytothenextpartoftheinterface,theinput/outputsectionlfthemicrocomputeritself.TheI/Osectionconvertsdigital“on/off”voltagesignalstoaformwhichcanbepresentedtotheprocessorviatheviathesystembuses.Herethestateofeachinputlinewhetheritis“on”or“off”,isindicatedbyacorresponding“1”or“0”.Inthelineinputswhichhavebeenconvertedtodigitalform,thepatternsofonesandzerosintheinternalrepresentationwillformbinarynumberscorrespondingtothequantitybeingconverted.The“raw”numbersfromtheinterfacearelimitedbythedesignoftheinterfacecircuitryandtheyoftenrequirelinearizationandscalingtoproducevaluessuitableforuseinthemainprogram.Forexample,theinterfacenightberisetoconverttemperaturesintherange–20to–+50dress,buythenumbersproducedbyan8-bitconverterwilllieintherange0to255.Obviouslyitiseasier,theprogrammer‘spointofviewtodealdirectlywithtemperatureratherthantoworkouttheequivalentofanygiventemperatureintermsofthenumbersproducedbytheADC.Everytimetheinterfaceisusedtoreadatransducer,thesameoperationsmustbecarriedouttoconverttheinputnumberintoamoreconvenientform.Addtionarly,theoperationofsomeinterfacesrequirescontrolsignalstobepassedbetweenthemicrocomputerandcomponentsoftheinterface,Forthesereasonsitisnormaltouseasubroutinetolootafterthedetailedoperationoftheinterfaceandcarryoutanyscalingand/orlinearizationwhichmightbeneeded.Outputinterfacestakeasimilarform(Fig.10-2),thebiopicdifferencebeingthatheretheflowofinformationisintheoppositedirection;itispassedfromtheprogramtotheoutsideworld.Inthiscasetheprogrammaycallanoutputsubroutinewhichsupervisestheoperationoftheinterfaceandperformsthescalingnumberswhichmaybeneededforadigital-to-analogconverter(DAC).ThissubroutinepassesinformationintermtoanoutanalogformusingaDAC.Finallythesignalisconditioned(usuallyamplified)toaformsuitableforoperatinganactuator.Fig10-2outputInterfaceThesignalsusedwithinmicrocomputercircuitsarealmostalwaystoosmalltobeconnecteddirectlytothe“outsideworld”andsomekingofinterfacemustbeusedtotranslatethemtoamoreappropriateform.Thedesignofsectionofinterfacecircuitsisoneofthemostimportanttasksfacingtheengineerwishingtoapplymicrocomputers.Wehaveseenthatinmicrocomputersinformationisrepresentedasdiscretepatternsofbits;thisdigitalformismostusefulwhenthemicrocomputeristobeconnectedtoequipmentwhichcanonlybeswitchedonoroff,whereeachbitmightrepresentthestateofaswitchoractuator.Caremustbetakenwhenconnectinglogiccircuitstoensurethattheirlogiclevelsandcurrentratingsarecompatible.Theoutputvoltagesproducedbyalogiccircuitarenormallyspecifiedintermsofworstcasevalueswhensourcingorsinkingthemaximumratedcurrents.ThusVOHistheguaranteedminimum“high”voltagewhensourcingthemaximumrate“high”outputcurrentIOH,whileVOListheguaranteed“l(fā)ow”outputvoltagewhensinkingthemaximumrated“l(fā)ow”outputcurrentIOL.Therearecorrespondingspecificationsforlogicinputswhichspecifytheminimuminputvoltagewhichwillberecognizedasalogic“high”stateVIH,andthemaximuminputvoltagewhichwillberegardedasalogic“l(fā)ow”stateVIL.Forinputinterface,perhapsthemainproblemfacingthedesigneristhatofelectricalnoise.Smallnoisesignalmaycausethesystemtomalfunction,whilelargeramountsofmoistcanpermanentlydamageit.Thedesignermustbeawareofthesedangersfromtheoutset.Therearemanymethodstoprotectinterfacecircuitsandmicrocomputerfromvariouskindsofnoise.Followingissomeexamples:1.Inputandoutputelectricalisolatingbetweenthemicrocomputersystemandexternaldevicesusinganopt-isolatororatransformer.2.Removinghighfrequencynoisepulsesbyalow-peafilterandSchmitt-trigger.3.Protectingagainstexcessiveinputvoltagesusingapairofdiodestopowersupplyreversiblybiasedinnormaldirection.Foroutputinterface,parametersVOH,VOL,IOHandIOLofalogicdeviceareusuallymuchtolowtoallowloadstobeconnecteddirectly,andinpracticeanexternalcircuitmustbeconnectedtoamplifythecurrentandvoltagetodriveaload.AlthoughseveraltypesofsemiconductordevicesarenowavailableforcontrollingDCandACpowersuptomanykilowatts,therearetwobasicwaysinwhichaswitchcanbeconnectedtoaloadtocontrolit:seriesconnectionandshuntconnectionasshowninFigure10-3.Fig10-3SeriesandShuntConnectionWithseriesconnection,theswitchallowscurrenttoflowthroughtheloadwhenclosed,whilewithshuntconnectionclosingtheswitchallowscurrenttobypasstheload.Bothconnectionsareusefulinlow-powercircuits,butonlytheseriesconnectioncanbeusedinhigh-powercircuitsbecauseofthepowerwastedintheseriesresistorR.THEINTRODUCTIONOFAT89S52FeaturesoftheAT89S52?CompatiblewithMCS-51?Products?8KBytesofIn-SystemReprogrammableFlashMemory?Endurance:1,000Write/EraseCycles?FullyStaticOperation:0Hzto24MHz?Three-levelProgramMemoryLock?256x8-BitInternalRAM?32ProgrammableI/OLines?Three16-bitTimer/Counters?EightInterruptSources?ProgrammableSerialChannel?LowPowerIdleandPowerDownModesDescriptionTheAT89S52isalow-power,high-performanceCMOS8-bitmicrocomputerwith8KbytesofFlashprogrammableanderasablereadonlymemory(PEROM).ThedeviceismanufacturedusingAtmel’shighdensitynonvolatilememorytechnologyandiscompatiblewiththeindustrystandard80S51and80S52instructionsetandpinout.Theon-chipFlashallowstheprogrammemorytobereprogrammedin-systemorbyaconventionalnonvolatilememoryprogrammer.Bycombiningaversatile8-bitCPUwithFlashonamonolithicchip,theAtmelAT89S52isapowerfulmicrocomputerwhichprovidesahighlyflexibleandcosteffectivesolutiontomanyembeddedcontrolapplications.TheAT89S52providesthefollowingstandardfeatures:8KbytesofFlash,256bytesofRAM,32I/Olines,three16-bittimer/counters,asix-vectortwo-levelinterruptarchitectureafullduplexserialport,on-chiposcillator,andclockcircuitry.Inaddition,theAT89S52isdesignedwithstaticlogicforoperationdowntozerofrequencyandsupportstwosoftwareselectablepowersavingmodes.TheIdleModestopstheCPUwhileallowingtheRAMtimer/counters,serialport,andinterruptsystemtocontinuefunctioning.ThePowerDownModesavestheRAMcontentsbutfreezestheoscillator,disablingallotherchipfunctionsuntilthenexthardwarereset.PinDescriptionVCCSupplyvoltage.GNDGround.Port0Port0isan8-bitopendrainbidirectionalI/Oport.Asanoutputport,eachpincansinkeightTTLinputs.When1sarewrittentoport0pins,thepinscanbeusedashighimpedanceinputs.Port0canalsobeconfiguredtobethemultiplexedloworderaddress/databusduringaccessestoexternalprogramanddatamemory.Inthismode,P0hasinternalpullups.Port0alsoreceivesthecodebytesduringFlashprogrammingandoutputsthecodebytesduringprogramverification.Externalpullupsarerequiredduringprogramverification.Port1Port1isan8-bitbidirectionalI/Oportwithinternalpullups.ThePort1outputbufferscansink/sourcefourTTLinputs.When1sarewrittentoPort1pins,theyarepulledhighby.Theinternalpullupsandcanbeusedasinputs.Asinputs,Port1pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseoftheinternalpullups.Inaddition,P1.0andP1.1canbeconfiguredtobethetimer/counter2externalcountinput(P1.0/T2)andthetimer/counter2triggerinput(P1.1/T2EX),respectively,asshowninthefollowingtable.Port1alsoreceivesthelow-orderaddressbytesduringFlashprogrammingandverification.TABLE1--PortPinfunctionPortpinAlternateFunctionsP1.0T2(externalcountinputtoTimer/Counter2),clock-outP1.1T2EX(Timer/Counter2capture/reloadtriggeranddirectioncontrol)Port2Port2isan8-bitbidirectionalI/Oportwithinternalpullups.ThePort2outputbufferscansink/sourcefourTTLinputs.When1sarewrittentoPort2pins,theyarepulledhighbytheinternalpullupsandcanbeusedasinputs.Asinputs,Port2pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseoftheinternalpullups.Port2emitsthehigh-orderaddressbyteduringfetchesfromexternalprogrammemoryandduringaccessestoexternaldatamemorythatuse16-bitaddresses(MOVX@DPTR).Inthisapplication,Port2usesstronginternalpull-upswhenemitting1s.Duringaccessestoexternaldatamemorythatuse8-bitaddresses(MOVX@RI),Port2emitsthecontentsoftheP2SpecialFunctionRegister.Port2alsoreceivesthehigh-orderaddressbitsandsomecontrolsignalsduringFlashprogrammingandverification.Port3Port3isan8-bitbidirectionalI/Oportwithinternalpullups.ThePort3outputbufferscansink/sourcefourTTLinputs.When1sarewrittentoPort3pins,theyarepulledhighbytheinternalpullupsandcanbeusedasinputs.Asinputs,Port3pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseofthepullups.89S52系列微控制器89S52系列微控制器是基于高度完善的嵌入式控制系統(tǒng)的體系結構。從軍事設備到汽車,再到PC機的鍵盤,它都有很廣泛的應用。另外,對于摩托羅拉公司生產(chǎn)的M68HC11(8位處理器)可以應用于不同廠商生產(chǎn)的89S52系列微控制器,如:Intel、Philips及Siemens等。這些廠商都對89S52增加了許多功能部件和外圍設備,如:12C總線接口、模/數(shù)轉換器、監(jiān)視跟蹤定時器和脈沖寬度調制輸出。89S52的允許范圍:時鐘頻率上至40MHz,電壓下至1.5V都是有效的。一個公司的生產(chǎn)線要完成許多功能,開發(fā)人員就不得不學習這個平臺,為此以89S52系列作為基本體系結構是最好的選擇,以它為核心得到了廣泛的應用?;倔w系結構由下列功能部件組成:1.8位ALU;2.32個I/O引腳(4組,每組8個),可分別存??;3.2個16位定時/計數(shù)器;4.全雙工通用異步收發(fā)器;5.6個中斷源,2個中斷優(yōu)先級;6.128字節(jié)隨機存儲器;7.64字節(jié)地址空間,存放數(shù)據(jù)和代碼。一個89S52的處理器周期是由12個振蕩周期組成。12個振蕩周期中每一個都能完成一種特殊功能,89S52的核心如:操作碼的取出、典型的菊花鏈待定中斷。任何8051指令所需的定時都是由時鐘脈沖頻率除以12,再將所得結果乘以處理機所需的循環(huán)數(shù)計算得到。因此,如果你有一個系統(tǒng)時鐘11.059MHz,你可以用這個值除以12計算出每秒所需指令數(shù)。這里我們給出一個指令頻率921583/秒。將它轉化成實際時間,每個指令周期(1.085微妙)。1.存儲器組織89S52體系結構為用戶提供了3個物理直接存儲空間。每個存儲空間占用連續(xù)地址空間,按字節(jié)從0到最大尺寸。地址重疊是通過利用引用特定地址空間指令來解決的。這三個存儲空間功能如下所述:2.代碼空間第一個存儲空間是代碼段,其中用來存放可執(zhí)行程序。這個段最大可達64K(因為它有16根地址線)。處理機將它視為只讀,能產(chǎn)生相應的信號對一存儲器件進行存取,如可擦可編程只讀存儲器EPROM。然而,這不意味著代碼段必須作為EPROM的工具。目前,許多嵌入式系統(tǒng)都利用EPROM,通過89S52或一個外部設備允許對它存儲或改寫。這可能輕而易舉的提高產(chǎn)品,因為新的軟件可以下載到EPROM,而不必將它分解后再安裝成一個新的EPROM。另外,電池后面的靜態(tài)存儲器SRAM也可用來代替EPROM。這種方法和加載軟件到電可擦可編程只讀存儲器EEPROM是一樣的,但是EEPROM沒有任何讀/寫周期限制。然而,當電池電源RAM沒電了,也可如此將軟件加載到里面。在開發(fā)系統(tǒng)中若用SRAM代替EPROM,則允許在目標系統(tǒng)中快速下載新代碼。如果可以那樣做,它將幫助我們避免對EPROM的循環(huán)執(zhí)行/測試/擦寫,同時也能幫助我們避免對通常很少使用的線路仿真器產(chǎn)生爭論。除可執(zhí)行程序代碼之外,89S52通常在代碼段存放安裝查找表。為了簡化,89S52提供了允許快速存取查找表指令的途徑——數(shù)據(jù)指針(DPTR)或帶偏移量的程序計數(shù)器通過累加器隨意的指向查找表。通常這意味著,一個查找表的基地址能用DPTR來定位,而表中的元素可以通過累加器存儲。用89S52執(zhí)行加法,在指令執(zhí)行期間可以根據(jù)情況存放許多循環(huán)數(shù)。3.數(shù)據(jù)空間89S52輔助存儲空間是128字節(jié)的內部RAM,而89S52的高128字節(jié)是輔助存儲空間。這個段被認為是典型的數(shù)據(jù)段。RAM定位在這個段,依靠指令循環(huán)存取一次或二次。這樣存取時間比存取在XDATA段要快很多,因為存儲器直接給出地址,勝于由存儲指針如DPTR必須先初始化。因此,通常將已用變量和臨時定義變量都放在數(shù)據(jù)段。然而,這樣的分配會占用段中少量的存儲單元。數(shù)據(jù)段中的可變存儲器還可以由R0或R1間接存儲。使用寄存器作存儲指針就必須包含已檢索或已改變字節(jié)的地址。這些指令可以依靠源/目的數(shù)據(jù)字節(jié)使一個或二個處理機循環(huán)。數(shù)據(jù)段又包含兩個重要的小段。第一個子段由四個寄存器組組成,它占用了RAM的低32字節(jié)。89S52用這四組(每組8字節(jié))作為缺省寄存器組。寄存器組選定區(qū)域在任何時候都通過處理機狀態(tài)字(PSW)中的RS1和RS0這兩位來改變。這兩位組合表示數(shù)0~3(RS1作最高有效位),用來指明哪個寄存器組在被使用。在89S52中,寄存器組開關不但允許快速參數(shù)傳遞,而且能打開單任務開關。在數(shù)據(jù)空間的第二個子段是一個可尋址位段,每一位都能單獨存取。這個段稱為BDATA段??蓪ぶ返奈欢斡蓛却嬷兴膫€寄存器組16字節(jié)(128位)組成。89S52包含許多位指令,它通常用于控制某一位的應用及在89S52中用軟件替換外部組合邏輯給予幫助,這樣在目標系統(tǒng)中以減少部分依賴。人們注意到這個16字節(jié)還可以按“一位”寬在數(shù)據(jù)空間像其他字節(jié)一樣進行存取。4.特殊功能寄存器89S52內部RAM的80H以上的單元為控制寄存器,包含中斷系統(tǒng)和外部設備。這些寄存器稱為特殊功能寄存器(簡稱SFR)。它們大部分是可按位尋址的。在可按位尋址的SFR中的位可以是被訪問的名稱、索引或者是位地址。因此,你可以參看中斷允許SFR中的EA(EA、IE.7或0AFH)位。SFR可控制的東西有:定時/計數(shù)器和UART的功能。中斷源以及它們的優(yōu)先級。這些被訪問的寄存器在數(shù)據(jù)段中的字節(jié)和位是同一張指令表。表A所示SFR的存儲圖中指明了可尋址的位寄存器。5.IDATA空間某些89S52家族成員,如89S52在內部RAM中包含一個輔助128字節(jié),存放在80H以上的單元。這個典型的RAM段被稱為IDATA段。因為IDATA地址和SFR地址重疊,IDATARAM和SFR之間的地址沖突是通過分解被存取存儲器的類型來解決,因為IDATA段只能通過間接尋址方式存取。6.XDATA空間89S52存儲空間為64K,代碼段可用16根地址線尋址。這個典型空間被稱為外部數(shù)據(jù)存儲空間(簡稱XDATA段)。這個段通常由各種RAM(通常為SRAM)、I/O設備或外圍設備組成,89S52必須通過總線連接。這個段的讀或寫操作至少需兩次循環(huán)處理,并且它的執(zhí)行既要用到DPTR又要用到R0和R1。就DPTR來說,它通常要在執(zhí)行讀或寫操作所要求的兩個循環(huán)外再附加加載兩個或更多循環(huán)處理地址。同樣,在一個周期內除了利用存儲器自身存取之外,至少要加載R0或R1。顯而易見,XDATA段的典型操作很簡單,通常最少需三個循環(huán)處理。因此,數(shù)據(jù)段常用來存儲常用變量。如果89S52不需要用總線執(zhí)行任何I/O設備或者設計者希望當I/O設備通過總線存取時讓RAM循環(huán)開、關,那么它可使這個段全部占滿64KRAM。7.微機接口微機接口實現(xiàn)兩種信息形式的交換。在計算機之外,由電子系統(tǒng)所處理以一種物理形式存在,但在程序中,它是用數(shù)字表示的。任一接口的功能都可分為以某種形式進行數(shù)據(jù)變換的一些操作,所以外部和內部形式的轉換由許多步驟完成的。所示的情況為例加以說明,圖中展示了微計算機和產(chǎn)生的信號和形式被系統(tǒng)的其他部分處理之前需要再次轉換.舉例來說,許多傳感器具有電阻變化,這必須由一專門電路轉換成電壓。這種將傳感器輸出轉換成電壓信號,并與系統(tǒng)的其他電路相連接的過程,稱為信號調理。信號調理部分將源自傳感器的電壓

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論