基于AT89C52单片机的交通灯控制系统的设计文档格式.docx

上传人:b****4 文档编号:6709906 上传时间:2023-05-07 格式:DOCX 页数:19 大小:221.75KB
下载 相关 举报
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第1页
第1页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第2页
第2页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第3页
第3页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第4页
第4页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第5页
第5页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第6页
第6页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第7页
第7页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第8页
第8页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第9页
第9页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第10页
第10页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第11页
第11页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第12页
第12页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第13页
第13页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第14页
第14页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第15页
第15页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第16页
第16页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第17页
第17页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第18页
第18页 / 共19页
基于AT89C52单片机的交通灯控制系统的设计文档格式.docx_第19页
第19页 / 共19页
亲,该文档总共19页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

基于AT89C52单片机的交通灯控制系统的设计文档格式.docx

《基于AT89C52单片机的交通灯控制系统的设计文档格式.docx》由会员分享,可在线阅读,更多相关《基于AT89C52单片机的交通灯控制系统的设计文档格式.docx(19页珍藏版)》请在冰点文库上搜索。

基于AT89C52单片机的交通灯控制系统的设计文档格式.docx

Features

CompatiblewithMCS-51™Products

8KBytesofIn-SystemReprogrammableFlashMemory

Endurance:

1,000Write/EraseCycles

FullyStaticOperation:

0Hzto24MHz

Three-levelProgramMemoryLock

256x8-bitInternalRAM

32ProgrammableI/OLines

Three16-bitTimer/Counters

EightInterruptSources

ProgrammableSerialChannel

Low-powerIdleandPower-downModes

Description

TheAT89C52isalow-power,high-performanceCMOS8-bitmicrocomputerwith8KbytesofFlashprogrammableanderasablereadonlymemory(PEROM).ThedeviceismanufacturedusingAtmel’shigh-densitynonvolatilememorytechnologyandiscompatiblewiththeindustry-standard80C51and80C52instructionsetandpinout.Theon-chipFlashallowstheprogrammemorytobereprogrammedin-systemorbyaconventionalnonvolatilememoryprogrammer.Bycombiningaversatile8-bitCPUwithFlashonamonolithicchip,theAtmelAT89C52isapowerfulmicrocomputerwhichprovidesahighly-flexibleandcost-effectivesolutiontomanyembeddedcontrolapplications.

PinConfigurations

BlockDiagram

PinDescription

VCC

Supplyvoltage.

GND

Ground.

Port0

Port0isan8-bitopendrainbi-directionalI/Oport.Asanoutputport,eachpincansinkeightTTLinputs.When1sarewrittentoport0pins,thepinscanbeusedashigh-impedanceinputs.Port0canalsobeconfiguredtobethemultiplexedlow-orderaddress/databusduringaccessestoexternalprogramanddatamemory.Inthismode,P0hasinternalpull-ups.Port0alsoreceivesthecodebytesduringFlashprogrammingandoutputsthecodebytesduringprogramverification.Externalpull-upsarerequiredduringprogramverification.

Port1

Port1isan8-bitbi-directionalI/Oportwithinternalpull-ups.ThePort1outputbufferscansink/sourcefourTTLinputs.When1sarewrittentoPort1pins,theyarepulledhighbytheinternalpull-upsandcanbeusedasinputs.Asinputs,Port1pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseoftheinternalpull-ups.Inaddition,P1.0andP1.1canbeconfiguredtobethetimer/counter2externalcountinput(P1.0/T2)andthetimer/counter2triggerinput(P1.1/T2EX),respectively,asshowninthefollowingtable.Port1alsoreceivesthelow-orderaddressbytesduringFlashprogrammingandverification.

Port2

Port2isan8-bitbi-directionalI/Oportwithinternalpull-ups.ThePort2outputbufferscansink/sourcefourTTLinputs.When1sarewrittentoPort2pins,theyarepulledhighbytheinternalpull-upsandcanbeusedasinputs.Asinputs,Port2pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseoftheinternalpull-ups.Port2emitsthehigh-orderaddressbyteduringfetchesfromexternalprogrammemoryandduringaccessestoexternaldatamemoriesthatuse16-bitaddresses(MOVX@DPTR).Inthisapplication,Port2usesstronginternalpull-upswhenemitting1s.Duringaccessestoexternaldatamemoriesthatuse8-bitaddresses(MOVX@RI),Port2emitsthecontentsoftheP2SpecialFunctionRegister.Port2alsoreceivesthehigh-orderaddressbitsandsomecontrolsignalsduringFlashprogrammingandverification.

Port3

Port3isan8-bitbi-directionalI/Oportwithinternalpull-ups.ThePort3outputbufferscansink/sourcefourTTLinputs.When1sarewrittentoPort3pins,theyarepulledhighbytheinternalpull-upsandcanbeusedasinputs.Asinputs,Port3pinsthatareexternallybeingpulledlowwillsourcecurrent(IIL)becauseofthepull-ups.

Port3alsoservesthefunctionsofvariousspecialfeaturesoftheAT89C51,asshowninthefollowingtable.Port3alsoreceivessomecontrolsignalsforFlashprogrammingandverification.

RST

Resetinput.Ahighonthispinfortwomachinecycleswhiletheoscillatorisrunningresetsthedevice.

ALE/

AddressLatchEnableisanoutputpulseforlatchingthelowbyteoftheaddressduringaccessestoexternalmemory.Thispinisalsotheprogrampulseinput(

)duringFlashprogramming.Innormaloperation,ALEisemittedataconstantrateof1/6theoscillatorfrequencyandmaybeusedforexternaltimingorclockingpurposes.Note,however,thatoneALEpulseisskippedduringeachaccesstoexternaldatamemory.Ifdesired,ALEoperationcanbedisabledbysettingbit0ofSFRlocation8EH.Withthebitset,ALEisactiveonlyduringaMOVXorMOVCinstruction.Otherwise,thepinisweaklypulledhigh.SettingtheALE-disablebithasnoeffectifthemicrocontrollerisinexternalexecutionmode.

ProgramStoreEnableisthereadstrobetoexternalprogrammemory.WhentheAT89C52isexecutingcodefromexternalprogrammemory,

isactivatedtwiceeachmachinecycle,exceptthattwo

activationsareskippedduringeachaccesstoexternaldatamemory.

/VPP

ExternalAccessEnable.

mustbestrappedtoGNDinordertoenablethedevicetofetchcodefromexternalprogrammemorylocationsstartingat0000HuptoFFFFH.Note,however,thatiflockbit1isprogrammed,

willbeinternallylatchedonreset.EAshouldbestrappedtoVCCforinternalprogramexecutions.Thispinalsoreceivesthe12-voltprogrammingenablevoltage(VPP)duringFlashprogrammingwhen12-voltprogrammingisselected.

XTAL1

Inputtotheinvertingoscillatoramplifierandinputtotheinternalclockoperatingcircuit.

XTAL2

Outputfromtheinvertingoscillatoramplifier.

SpecialFunctionRegisters

Amapoftheon-chipmemoryareacalledtheSpecialFunctionRegister(SFR)spaceisshownintheTable1.Notethatnotalloftheaddressesareoccupied,andunoccupiedaddressesmaynotbeimplementedonthechip.Readaccessestotheseaddresseswillingeneralreturnrandomdata,andwriteaccesseswillhaveanindeterminateeffect.Usersoftwareshouldnotwrite1stotheseunlistedlocations,sincetheymaybeusedinfutureproductstoinvokenewfeatures.Inthatcase,theresetorinactivevaluesofthenewbitswillalwaysbe0.

Timer2Registers

ControlandstatusbitsarecontainedinregistersT2CONandT2MODforTimer2.Theregisterpair(RCAP2H,RCAP2L)aretheCapture/ReloadregistersforTimer2in16-bitcapturemodeor16-bitauto-reloadmode.

InterruptRegisters

TheindividualinterruptenablebitsareintheIEregister.TwoprioritiescanbesetforeachofthesixinterruptsourcesintheIPregister.

DataMemory

TheAT89C52implements256bytesofon-chipRAM.Theupper128bytesoccupyaparalleladdressspacetotheSpecialFunctionRegisters.Thatmeanstheupper128byteshavethesameaddressesastheSFRspacebutarephysicallyseparatefromSFRspace.

Whenaninstructionaccessesaninternallocationaboveaddress7FH,theaddressmodeusedintheinstructionspecifieswhethertheCPUaccessestheupper128bytesofRAMortheSFRspace.InstructionsthatusedirectaddressingaccessSFRspace.Forexample,thefollowingdirectaddressinginstructionaccessestheSFRatlocation0A0H.

MOV0A0H,#data

Instructionsthatuseindirectaddressingaccesstheupper128bytesofRAM.Forexample,thefollowingindirectaddressinginstruction,whereR0contains0A0H,accessesthedatabyteataddress0A0H,ratherthanP2(whoseaddressis0A0H).

MOV@R0,#data

Notethatstackoperationsareexamplesofindirectaddressing,sotheupper128bytesofdataRAMareavailableasstackspace.

Timer0and1

Timer0andTimer1intheAT89C52operatethesamewayasTimer0andTimer1intheAT89C51.

Timer2

Timer2isa16-bitTimer/Counterthatcanoperateaseitheratimeroraneventcounter.ThetypeofoperationisselectedbybitC/T2intheSFRT2CON.Timer2hasthreeoperatingmodes:

capture,auto-reload(upordowncounting),andbaudrategenerator.ThemodesareselectedbybitsinT2CON,asshowninTable3.Timer2consistsoftwo8-bitregisters,TH2andTL2.IntheTimerfunction,theTL2registerisincrementedeverymachinecycle.Sinceamachinecycleconsistsof12oscillatorperiods,thecountrateis1/12oftheoscillatorfrequency.

IntheCounterfunction,theregisterisincrementedinresponsetoa1-to-0transitionatitscorrespondingexternalinputpin,T2.Inthisfunction,theexternalinputissampledduringS5P2ofeverymachinecycle.Whenthesamplesshowahighinonecycleandalowinthenextcycle,thecountisincremented.ThenewcountvalueappearsintheregisterduringS3P1ofthecyclefollowingtheoneinwhichthetransitionwasdetected.Sincetwomachinecycles(24oscillatorperiods)arerequiredtorecognizea1-to-0transition,themaximumcountrateis1/24oftheoscillatorfrequency.Toensurethatagivenlevelissampledatleastoncebeforeitchanges,thelevelshouldbeheldforatleastonefullmachinecycle.

CaptureMode

Inthecapturemode,twooptionsareselectedbybitEXEN2inT2CON.IfEXEN2=0,Timer2isa16-bittimerorcounterwhichuponoverflowsetsbitTF2inT2CON.Thisbitcanthenbeusedtogenerateaninterrupt.IfEXEN2=1,Timer2performsthesameoperation,buta1-to-0transitionatexternalinputT2EXalsocausesthecurrentvalueinTH2andTL2tobecapturedintoRCAP2HandRCAP2L,respectively.Inaddition,thetransitionatT2EXcausesbitEXF2inT2CONtobeset.TheEXF2bit,likeTF2cangenerateaninterrupt.ThecapturemodeisillustratedinFigure1.

Auto-reload(UporDownCounter)

Timer2canbeprogrammedtocountupordownwhenconfiguredinits16-bitauto-reloadmode.ThisfeatureisinvokedbytheDCEN(DownCounterEnable)bitlocatedintheSFRT2MOD.Uponreset,theDCENbitissetto0sothattimer2willdefaulttocountup.WhenDCENisset,Timer2cancountupordown,dependingonthevalueofth

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2