Vous êtes sur la page 1sur 14

8051and8051Microcontroller

Amicrocontrollerisaneconomicalcomputeronachipbuiltfordealingwithspecifictasks,such asdisplayingorreceivinginformationthroughLEDsorremotecontrolleddevices.Themost commonlyusedsetofmicrocontrollersbelongto8051Family.8051Microcontrollerscontinueto remainapreferredchoiceforavastcommunityofhobbyistsandprofessionals.Through8051, theworldbecamewitnesstothemostrevolutionarysetofmicrocontrollers.

8051Family Intelfabricatedtheoriginal8051whichisknownasMCS51.Theothertwomembersofthe8051 familyare: i. 8052Thismicrocontrollerhas256bytesofRAMand3timers.Inadditiontothe standardfeaturesof8051,thismicrocontrollerhasanadded128bytesofRAMandtimer.Ithas 8KbytesofonchipprogramROM.Theprogramswrittenforprojectsusing8051microcontroller canbeusedtorunontheprojectsusing8052microcontrolleras8051isasubsetof8052. ii. 8031Thismicrocontrollerhasallthefeaturesof8051exceptforittobeROMless.An externalROMthatcanbeaslargeas64Kbytesshouldbeprogrammedandaddedtothischip forexecution.ThedisadvantageofaddingexternalROMisthat2ports(outofthe4ports)are used.Hence,only2portsareleftforI/Ooperationswhichcanalsobeaddedexternallyif requiredforexecution.

Comparisonof8051familymembers: Features RAM(bytes) ROM Timers Serialport I/Opins Interruptsources 8051 128 4K 2 1 32 6 8052 256 8K 3 1 32 8 8031 128 0K 2 1 32 6

Table1.1Comparisonof8051familymembers Various8051microcontrollers 8051microcontrollersusetwodifferentkindsofmemorysuchasUVEPROM,Flashand NVRAM.Hence8051willnotbeseeninthepartnumbereventhoughitisthemostpopular memberofthe8051family. i.8751ThismicrocontrolleristheUVEPROMversionof8051.Thischiphas only4KbytesofUVEPROM.ItisrequiredtohaveaccesstothePROMburnerandthe UVEPROMerasertoerasethecontentsinsidethechipbeforeitisprogrammedagain.The disadvantageofusingthismemoryisthewaitingtimeofaround20minutestoerasethe contentsinordertoprogramitagain.Duetothislimitation,manufacturersfabricatedflashand NVRAMversionsof8051. ii.AT89C51fromAtmelCorporationAtmelfabricatedtheflashROMversionof 8051whichispopularlyknownasAT89C51(CinthepartnumberindicatesCMOS).Theflash memorycanerasethecontentswithinsecondswhichisbestforfastgrowth.Therefore,8751is replacedbyAT89C51toeradicatethewaitingtimerequiredtoerasethecontentsandhence expeditethedevelopmenttime.TobuildupamicrocontrollerbasedsystemusingAT89C51,itis essentialtohaveROMburnerthatsupportsflashmemory.NotethatinFlashmemory,entire contentsmustbeerasedtoprogramitagain.ThecontentsareerasedbytheROMburner. AtmelisworkingonanewerversionofAT89C51thatcanbeprogrammedusingtheserialCOM portofIBMPCinordertogetridoftheROMburner. Part Number AT89C51 AT89C52 AT89C105 ROM 4K 8K 1K RAM 128 256 64 I/Opins 32 32 15 Timer 2 3 1 Interrupt 6 8 3 Vcc 5V 5V 3V Packaging 40 40 20

1 AT89C205 1 AT89LV51 AT89LV52 2K 4K 8K 128 128 128 32 32 32 3 2 3 8 6 8 3V 3V 3V 20 40 40

Table1.2Versionsof8951fromAtmel(AllROMFlash) Therearedifferentversionsofpackagingandvariousspeedoftheproductsmentionedinthe abovetable. PartNumber Speed Pins 40 40 40 Packaging DIPPlastic DIPPlastic DIPPlastic Use Commercial Commercial Commercial

AT89C5112PC 12MHz AT89C5116PC 16MHz AT89C5120PC 20MHz

Table1.3VariousSpeedsof8051fromAtmel Note:ThepartnumberAT89C5116PCwhereATAtmel,CCMOS(consumesless power),12Speedas12MHz,PPlasticDIPpackaging,CCommercialuse. AT89C5112PCisfavourablyusedbystudentsfortheirprojects. iii.DS5000fromDallasSemiconductorDallasSemiconductorfabricatedtheNVRAM versionofthe8051whichisknownasDS5000.ThePCserialportisutilizedtoloadtheprogram ontotheinbuiltROM.TheadvantageofNVRAMmemoryisthefacilitytoerasethecontents onebyteatatime. v. Part Number DS50008 DS50003 2 DS5000T 8 DS5000T 8 RAM 128 128 128 128 ROM 8K 32K 8K 32K Timers 2 2 2 2 I/O pins 32 32 32 32 Interrupts 6 6 6 6 Vcc 5V 5V 5V 5V Packaging 40 40 40 40

Table1.4Versionsof8051fromDallasSemiconductor

ThevarietyrangeofspeedandpackagingversionsofDS5000whichisshownintheTable1.5 PartNumber DS500088 DS5000812 DS5000328 DS50003212 DS5000T812 DS5000T328 NVRAM 8K 8K 32K 32K 8K 32K Speed 8MHz 12MHz 8MHz 12MHz 12MHz 8MHz

Table1.5Versionsof8051DallasSemiconductor Note:ThepartnumberDS500088where88KNVRAM,8Speedof8MHz. DS5000812isfavourablyusedbystudentsfortheirprojects. iv. OneTimeProgrammable(OTP)versionsofthe8051Thisversionof microcontrollerischeaperandavailablefromvariousmanufacturers.Themanufacturersuse OTPmicrocontrollerformassproductionbecausethepriceperunitisverycheap.

Featuresof8051
Themainfeaturesof8051microcontrollerare: i.RAM128Bytes(Datamemory) ii.ROM4Kbytes(ROMsignifytheonchipprogramspace) iii.SerialPortUsingUARTmakesitsimplertointerfaceforserialcommunication. iv.Two16bitTimer/Counter v.Input/outputPins4Portsof8bitseachonasinglechip. vi.6InterruptSources vii.8bitALU(ArithmeticLogicUnit) viii.HarvardMemoryArchitectureIthas16bitAddressbus(eachofRAMandROM)and8bit DataBus. ix.8051canexecute1milliononecycleinstructionspersecondwitha clockfrequencyof12MHz.ThismicrocontrollerisalsocalledasSystemonachipbecauseit hasallthefeaturesonasinglechip.TheBlockDiagramof8051Microcontrollerisasshownin Figure1.1

MemoryArchitecture The4discretetypesofmemoryin8051are: i.InternalRAMThismemoryislocatedfromaddress0to0xff.Thememorylocationsfrom 0x00to0x7Fareaccesseddirectly.Thebytesfrom0x20to0x2Farebitaddressable.Loading R0andR1thememorylocationfrom0x80to0xFFcaneasilyaccessed.

Figure1.1BlockDiagramof8051Microcontroller

ii.SpecialFunctionRegisters(SFR)Locatedfromaddress0x80to0xFFofthememory location.ThesameinstructionsusedforlowerhalfofInternalRAMcanbeusedtoaccess SFRs.TheSFRsarebitaddressabletoo. iii.ProgramMemoryThisisreadonlymemorywhichislocatedataddress0.Withthehelpof 16bitSpecialFunctionRegisterDPTR,thismemorycanalsosavethetablesofconstants. iv.ExternalDataMemoryLocatedataddress0.TheInstructionMOVX(MoveExternal) shouldbeusedtoaccesstheexternaldatamemory.

Historyof8051andKeyDevelopments IntelCorporationfabricatedthe8bitmicrocontrollerwhichwasreferredasMCS51in1981. Thismicrocontrollerwasalsoreferredassystemonachipbecauseithas128bytesofRAM, 4KbytesofROM,2Timers,1Serialport,andfourportsonasinglechip.TheCPUcanworkfor only8bitsofdataatatimebecause8051isan8bitprocessor.Incasethedataislargerthan8 bitsthenithastobebrokenintopartssothattheCPUcanprocessconveniently.Most manufacturershaveput4KbytesofROMeventhoughthequantityofROMcanbeexceededup to64Kbytes. Intelpermittedothermanufacturerstofabricatedifferentversionsof8051butwiththelimitation thatcodecompatibilityshouldbemaintained.Thishasaddedadvantagethatiftheprogramis writtenthenitcanbeusedforanyversionof8051despiteofmanufacturer. Asyearspassedby,thequalityoftechnologysurpassedtheexpectationofthegreatestminds, withgadgetsbecomingsmaller,sleekerandmoreefficient.Microcontrollerswereseenasthe answertotherequirementsraisedinadvancedelectronics.Thisisthereasonwhy manufacturershavenowfocusedtheirproductionaroundthefollowingmaindevelopmental aspects: i.Easeofuse ii.Marketavailability iii.Lesspowerusage iv.Smallerprocessingpower v.MoreintegratedfeatureslikeRFandUSB vi.Smallerformfactors

Applications The8051hasbeeninuseinawidenumberofdevices,mainlybecauseitiseasytointegrate intoaprojectorbuildadevicearound.Thefollowingarethemainareasoffocus: i.EnergyManagement:Efficientmeteringsystemshelpincontrollingenergyusageinhomesand industrialapplications.Thesemeteringsystemsaremadecapablebyincorporating microcontrollers. ii.Touchscreens:Ahighnumberofmicrocontrollerprovidersincorporatetouchsensing capabilitiesintheirdesigns.Portableelectronicssuchascellphones,mediaplayersandgaming devicesareexamplesofmicrocontrollerbasedtouchscreens. iii.Automobiles:The8051findswideacceptanceinprovidingautomobilesolutions.Theyare widelyusedinhybridvehiclestomanageenginevariants.Additionally,functionssuchascruise controlandantibrakesystemhavebeenmademoreefficientwiththeuseofmicrocontrollers. iv.MedicalDevices:Portablemedicaldevicessuchasbloodpressureandglucosemonitors

usemicrocontrollerswilltodisplaydata,thusprovidinghigherreliabilityinprovidingmedical results. Programmingenvironmentandprogrammer Formerly,programmersusedmachinelanguageforcoding.Amachinelanguageisaprogram thatconsistsof0sand1swhichwasverydrearyforthehumanstoprogramanycomputer.In duecourseoftime,assemblylanguagewasdevelopedinordertospeeduptheprogramming andmakeiterrorfree.Assemblylanguageisalowlevellanguagewhichusesanassemblerto translatetheprogramintomachinecode.Thehighlevelprogramminglanguagessuchas BASIC,Pascal,Forth,C,C++,andJavaareavailabletocodetheprogramfor8051.Thesehigh levellanguagesmakeuseofaCompilertotranslateintomachinecode.Forexample,whena programiswritteninC,theprogramneedstobetranslatedintomachinelanguageusingC compiler.Usually,AssemblyandClanguageiswidelyusedfor8051programsascomparedto theotherhighlevellanguages. The8051providesatotaloffourportsforI/Ooperations.8051has40pins,ofwhich32pinsare setasideforthefourports.PO,P1,P2,andP3eachhave8pinsandcanbeusedforeither inputoroutput.TheremainingpinsaredesignatedasVrt,GND,XTAL1,XTAL2,RST,EA, ALE/PROGandPSEN. 8051allowsyoutomanipulateoneorallofthebitsofaport,thusprovidingprogrammerswitha uniqueandpowerfulfeature.8051providestheprogrammerwiththeabilitytoread,writeand modifyeachporttocustomizeapplicationsasmuchaspossible.

AT89C51 Microcontroller

AT89C51isan8bitmicrocontrollerandbelongstoAtmel's8051family.ATMEL89C51has4KB ofFlashprogrammableanderasablereadonlymemory(PEROM)and128bytesofRAM.Itcan beerasedandprogramtoamaximumof1000times. In40pinAT89C51,therearefourportsdesignatedasP1,P2,P3andP0.Allthese portbidirectionalports,i.e.,theycanbeusedasbothinputandoutputports.ExceptP0which needsexternalsare8bitpullups,restoftheportshaveinternalpullups.When1sarewritten

totheseportpins,theyarepulledhighbytheinternalpullupsandcanbeusedasinputs.These portsarealsobitaddressableandsotheirbitscanalsobeaccessedindividually. PortP0andP2arealsousedtoprovidelowbyteandhighbyteaddresses,respectively,when connectedtoanexternalmemory.Port3hasmultiplexedpinsforspecialfunctionslikeserial communication,hardwareinterrupts,timerinputsandread/writeoperationfromexternal memory.AT89C51hasaninbuiltUARTforserialcommunication.Itcanbeprogrammedto operateatdifferentbaudrates.Includingtwotimers&hardwareinterrupts,ithasatotalofsix interrupts.

PinDiagram:

Pin No 1 2 3 4 5 6 7 8 9 10

Function 8bitinput/outputport(P1)pins

Name P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7

ResetpinActivehigh Input(receiver)forserialcommunication RxD

Reset 8bit P3.0 input/output port(P3) pins P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Crystal2 Crystal1

11 12 13 14 15 16 17 18 19 20 21

Output(transmitter)forserialcommunication Externalinterrupt1 Externalinterrupt2 Timer1externalinput Timer2externalinput Writetoexternaldatamemory Readfromexternaldatamemory Quartzcrystaloscillator(upto24MHz)

TxD Int0 Int1 T0 T1 Write Read

Ground(0V) 8bitinput/outputport(P2)pins / Highorderaddressbitswheninterfacingwith externalmemory

Ground P2.0/A8

22 23 24 25 26 27 28 29 30 ProgramstoreenableReadfromexternal programmemory AddressLatchEnable ProgrampulseinputduringFlashprogramming 31 ExternalAccessEnableVccforinternal programexecutions Programmingenablevoltage12V(duringFlash programming) 32 8bitinput/outputport(P0)pins Loworderaddressbitswheninterfacingwith externalmemory 33 34 35 36 37 38 39 40 Supplyvoltage5V(upto6.6V)

P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 PSEN ALE Prog EA Vpp P0.7/AD7

P0.6/AD6 P0.5/AD5 P0.4/AD4 P0.3/AD3 P0.2/AD2 P0.1/AD1 P0.0/AD0 VCC

Vous aimerez peut-être aussi