Sie sind auf Seite 1von 3

10/23/2016

8051MemoryOrganization

8051MemoryOrganization
8051Specifics>

8051MemoryOrganization
The8051microcontroller'smemoryisdividedintoProgramMemoryandDataMemory.ProgramMemory(ROM)is
usedforpermanentsavingprogrambeingexecuted,whileDataMemory(RAM)isusedfortemporarilystoringand
keepingintermediateresultsandvariables.

ProgramMemory(ROM)
ProgramMemory(ROM)isusedforpermanentsavingprogram(CODE)beingexecuted.Thememoryisreadonly.
Dependingonthesettingsmadeincompiler,programmemorymayalsousedtostoreaconstantvariables.The8051
executesprogramsstoredinprogrammemoryonly.codememorytypespecifierisusedtorefertoprogrammemory.
8051memoryorganizationalowsexternalprogrammemorytobeadded.
HowdoesthemicrocontrollerhandleexternalmemorydependsonthepinEAlogicalstate.

InternalDataMemory
Upto256bytesofinternaldatamemoryareavailabledependingonthe8051derivative.Locationsavailabletothe
useroccupyaddressingspacefrom0to7Fh,i.e.first128registersandthispartofRAMisdividedinseveralblocks.
Thefirst128bytesofinternaldatamemoryarebothdirectlyandindirectlyaddressable.Theupper128bytesofdata
memory(from0x80to0xFF)canbeaddressedonlyindirectly.
http://download.mikroe.com/documents/compilers/mikroc/8051/help/8051_memory_organization.htm

1/3

10/23/2016

8051MemoryOrganization

SinceinternaldatamemoryisusedforCALLstackalsoandthereisonly256bytessplitedoverfewdifferentmemory
areasfineutilizingofthismemoryiscrucialforfastandcompactcode.Seetypesefficiencyalso.
Memoryblockintherangeof20hto2Fhisbitaddressable,whichmeansthateachbitbeingtherehasitsown
addressfrom0to7Fh.Sincethereare16suchregisters,thisblockcontainsintotalof128bitswithseparate
addresses(Bit0ofbyte20hhasthebitaddress0,andbit7ofbyte2Fhhasthebitaddress7Fh).
Threememorytypespecifierscanbeusedtorefertotheinternaldatamemory:data,idata,andbdata.

ExternalDataMemory
Accesstoexternalmemoryisslowerthanaccesstointernaldatamemory.Theremaybeupto64KBytesofexternal
datamemory.Several8051devicesprovideonchipXRAMspacethatisaccessedwiththesameinstructionsasthe
traditionalexternaldataspace.ThisXRAMspaceistypicallyenabledviapropersettingofSFRregisterandoverlaps
theexternalmemoryspace.Settingofthatregistermustbemanualydoneincode,beforeanyaccesstoexternal
memoryorXRAMspaceismade.
ThemikroCPROfor8051hastwomemorytypespecifiersthatreferstoexternalmemoryspace:xdataandpdata.

SFRMemory
The8051provides128bytesofmemoryforSpecialFunctionRegisters(SFRs).SFRsarebit,byte,orwordsized
registersthatareusedtocontroltimers,counters,serialI/O,portI/O,andperipherals.
RefertoSpecialFunctionRegistersformoreinformation.Seesbitalso.

http://download.mikroe.com/documents/compilers/mikroc/8051/help/8051_memory_organization.htm

2/3

10/23/2016

8051MemoryOrganization

Relatedtopics:Accessingindividualbits,SFRs,Memorytypespecifiers,Memorymodels

Copyright(c)20022013mikroElektronika.Allrightsreserved.
Whatdoyouthinkaboutthistopic?Sendusfeedback!

http://download.mikroe.com/documents/compilers/mikroc/8051/help/8051_memory_organization.htm

Wantmoreexamplesandlibraries?
Findthemon

3/3