付费下载
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、ChipSTC12C5204ADI/OportconfigurationSTC12C5204ADseriesmicrocontrolleritsallI/Oportsarecontrolledbythesoftwareconfigurationinto4kindsofworktype4typesarerespectively:quasitwo-waymouth(standardthe8051outputmode),push-pulloutput,onlyforinput(highresistance)oropen-drainoutputfunctions.Everymouthconsistso
2、ftwocontrolregistertherelevantpositioncontroleachpintypeofwork.STC12C5204ADseriesmicrocontrollertoelectricityreattachmentshallprevailtwo-waymouth(standardthe8051outputmode)mode:2Vabovehighlevel,0.8Vforlowlevelbelow.1. Quasitwo-waymouthoutputconfigurationQuasitwo-waymouthoutputtypecanbeusedasoutputan
3、dinputfunctionbutdon'tneedtoreconfiguremouthlinesoutputstate.Thisisbecausejuncturelinesoutputis1driveabilityisveryweak,allowingexternaldeviceswillitsdown.Whenpinsforlow,itoutputdrivingability,canabsorbtheconsiderablecurrent.Quasitwo-waymouthhave3pull_uptransistoradaptedtodifferentneeds.Inthethre
4、eandonetransistor,pulluptransistorcalledweakonpull",for1andpaternallineregistersitselfpinsfor1open.Thispull_upprovidesbasicdrivecurrentmakeprospectivetwo-waymouthfor1output.Ifapinfor1andoutputbyexternaldevicestodropdowntolow,pullupcloseandweak"veryweakpull_up"maintainopenposition,inor
5、dertoputthispinforlow,strongtopulltheexternaldevicesmusthaveenoughpowertomakepininfusedcurrentthresholdvoltageofavoltagetothefollowing.Article2pull_uptransistors,called"extremelyweakonpull",1latchpaternallinewhenopen.Whenpin,theveryweaksuspendedthepull_upsourcegeneratesveryweakandcurrentwi
6、llpinandhighlevel.Article3pull_uptransistorcalled"powerfulpull".Juncturelinelatchesfrom0to1,thejumpingtoacceleratemustpullupbylogic0totwo-waymouthlogic1conversion.Whenthishappened,powerfulpullopenabout2machinecycletomakepinscanquicklypulltotheearthhighlevel.Quasitwo-waymouthoutputshownbelo
7、w.STC12C520seriesmicrocontroller3Vdevice,iftheuserisinpinsplus5Vvoltage,therewillbeacurrentflowfrompins,thishascausedadditionalVDDpowerconsumption.Accordingly,theproposalisnotinquasitwo-waymouthmode3Vmicrocontrollerpinstoexert5Vvoltage,suchastheuseofwords,willaddcurrentlimitingresistor,orusingdioded
8、oinputisolation,orusetriodedooutputsegregation.Quasitwo-waymouthwithaschmidttriggerinputandainterfereneesuppressioncircuit.2. Thepush-pulloutputconfigurationThedrop-downpush-pulloutputconfigurationopen-drainoutputandthestructureandtheprospectivetwo-waymouthdownsamestructure,butwhenlatchesis1provides
9、continuousstrongpullup.Thepush-pullmodelneedmorecommonlyusedfordrivingcurrentsituation.Thepush-pullpinsconfigurationareshownbelow.LI诜存:竝捕<x理am3. Onlyforinput(highresistanee)configurationInputportconfigurationareshownbelow.靖14潦尙嶽也可承受綸山低时仅比輸人m时.不奪佻駆入20“巾漩的能乍収!':或VIJv:.:'洛口丁制Inputportwithasc
10、hmidttriggerinputandainterferencesuppressioncircuit.4. Open-drainoutputconfigurationJuncturelinelatchesis0,theopen-drainoutputcloseallpull_uptransistors.When,asalogicaloutput,thisconfigurationmodemusthaveexternallypull,usuallybyresistancereceivingVDDoutside.Thisstyleofdrop-downandquasitwo-waymouthth
11、esame.Thejammerlineconfigurationareshownbelow.Open-drainportwithaschmidttriggerinputandainterferencesuppressioncircuit.输出恆时AtypicaltransistorcontrolcircuitIfuseweakpull_upcontrol,suggestonpluspull-upresistorsR1(3.3K10K),ifnotaddpull-upresistorsR1(3.3K10K),suggestR2valueinthe15Kabove,oruseastrongpush
12、-pulloutput.STC12C5204ADseriesmicrocontrollerprogrammablecounterarray(PCA)PCAcontainsaspecial16timer,hasfour16bitsofcapture/comparisonofmoduleandconnected.EachmoduleprogrammableworkInfourmode:increase/decreasealongthecapture,softwaretimer,high-speedoutputorcouldbemodulatedpulseoutput.Modulesconnecte
13、dtoP3.7(0CEX0/PCA0/PWM0),module1connectedtoP3.5(CEX1/PCA1/PWM1),modulesconnectedtoP2.0(2CEX2/PCA2/PWM2),modulesconnectedtoP2.4(3CEX3/PCA3/PWM3).RegisterthecontentofCHandCLisfreeof16PCAincreasingcountthevalueofthetimer.PCAtimerisfourmodules,thepublictimebenchmarkbyprogrammingwork.ProgrammableCounterA
14、rrayTOPCAadulchast.12FCAli£t<rxuptIDLFcr»L-”1-1CPalECFLCFCF-LCCF2CCFlCCFO|CCONPCATimer/CounterCMODSFRthereare2bytesandPCArelated.Theywere:CIDL,idlemodeallowsstopPCA;ECF,buya,enablingPCAinterrupt,whenPCAtimerspilloverwillPCAcountingoverflowmarksCCONSFR(CF)buybits.CCONSFRcontainsPCAoperat
15、ingcontrolbits(CR)andPCAtimermark(CF)andsymbolofeachmoduleCCF3/CCF2(CCFO).CCF1/ThroughthesoftwareforaCRbits(CCON.6)torunPCA.CRbitisresetwhenPCAclosed.WhenPCAcounteroverflow,CFpatients(CCON.7)buya,ifCMODregister,itproducesECFpositionadisruption.CFbitscanonlythroughsoftwarecleared.CCONregistera03isPCA
16、moduleslogo(a00,acorrespondingmodule1correspondingmodule1,bits2correspondingmodule2,a3correspondingmodule3),whenthereisamatchorbyhardwarebuyacomparisons.Thesesignalsaretheonlythroughsoftwarecleared.-ESn丨估F門|“刑眾TnT检丨Wn丨X®.爲咒;上:寫aoooPCAcaptureofpatterningIfCCONSFRbitsofthethroneofCCFnandCCAPMnSFR
17、ECCFnbitissetposition,willproducetheinterruption.AsoftwaretimermodeThroughtheCCAPMnregistersforaECOMandMATbits,canmakethePCAmoduleusedforsoftwaretimer(below).PCAtimervaluesandmoduleoftheregistercomparedtocapture,whenbothvaluesequal,ifaCCONSFRinCCFn(in)andaECCFnCCAPMnSFR)inallbuybits,willproducethein
18、terruption.A'IduIoCL'AP-I7/riletoCCAfnHF*£'r-?itC"m?itati>rlaCCFnCF|CR一CCF3WE|CCF1CCFDViTthTTT|-Erou-<?A?Fn|C4PXn00MATTOGnFnFCCTr.rrurPCASoftwareTimerMode/SoftwareTimermodel/PCAcomparativeModePCASoftwareTimerMode/SoftwareTimermodel/PCAcomparativeModeHigh-speedoutputmodelT
19、hismodel(below),whenPCAcounterplanofthenumericalandmodulecaptureregistersmatching,PCAvalueCEXnoutputwillhappenmoduleoftheflip.Toactivatethehigh-speedoutputmodesofCCAPMnTOGSFR,modules,MATandECOMbitmustbuybits.PCAHigh-Speed,OutputMode/PCAhigh-speedOutputMode先写后驾Xrltc5CCAPrtLitCCAPnK<r-ccC(T2cmccn1f
20、1(IWiOAftiLIT1血-=ircflup.iriTorfttrCHCLEaabt?:7::CTr.CE?x-ECOMn|CAPPnCAE'nMATnF¥Nn|EOTdtoo1(JCCAPUnInusePCAhigh-speedoutputmodespecialapplicationnote:IfacertainPCAmoduleworkinginhighspeedpulseoutputmode,wanttousesoftwareoutputchangethesamegroupofothercommonI/Oportstate,needtodofirst,whether
21、CCAPnHjudgeCHisequaltoabide,canfreelymodify,ifequal,anddetermineCCAPnLcircumstances>CLisallowedtochangethesamegroupofothercommonI/Oportstate.IfuseP3.7/PCA0/PWMOdoPCAhigh-speedpulseoutput,andtheprograminsideandwithsoftwareoutputchangewhenthestateP3.4mouth,youneedtodojudgment.WhenonehasthePCAhigh-s
22、peedpulseoutputfunctionofI/Omouthworkinginhighspeedpulseoutputmode,ifthesoftwareforthesamegroupofotherI/Oportoperation,ifmeetPCAcomparatormatching,thisoperationcanchangethepulseoutputfunctionwithPCAhigh-speedmouthoftheI/O.E?CnECCAPnHJ:!"Pul-0.>=:EF*CnL:匸CAPtiL“输出LCOFlin,n=0,1-£<X
23、7;tnL-irti.CAFXriIItATnECCFn1000110CLIo9-BTTCOMPARATOR0CLPCAPWMmode/modulationpulsewidthoutputmodeSinceallshareonlyPCAtimermodules,alltheiroutputfrequencyissame.Theoutputofeachmodule390visindependentofthechanges,andusingEPCnL,capturedCCAPnLofregistersconcerned.WhenCLSFRvalueislessthanCCAPnLEPCnL,whe
24、noutputislow,andthevalueofSFRwhenPCACLisequaltoorgreaterthanEPCnL,CCAPnL,theoutputashigh.WhenthevalueoftheCLbyFFintoEPCnH,00overflow,CCAPnHthecontentsofEPCnL,loadedintotheCCAPnL.Inthisway,canrealizeupdatePWMwithoutinterference.TomakeCCAPMnpWmmode,modulecanPWMnandECOMnbitsoftheregistertobuybits.译文芯片S
25、TC12C5204AD的I/O口配置STC12C5204AD系列单片机其所有I/O口均可由软件配置成4种工作类型4种类型分别为:准双向口(标准8051输出模式)、推挽输出、仅为输入(高阻)或开漏输出功能。每个口由2个控制寄存器中的相应位控制每个引脚工作类型。STC12C5204AD系列单片机上电复位后为准双向口(标准8051输出模式)模式:2V以上时为高电平,0.8V以下时为低电平。1.准双向口输出配置准双向口输出类型可用作输出和输入功能而不需重新配置口线输出状态。这是因为当口线输出为1时驱动能力很弱,允许外部装置将其拉低。当引脚输出为低时,它的驱动能力很强,可吸收相当大的电流。准双向口有3个
26、上拉晶体管适应不同的需要。在3个上拉晶体管中,有1个上拉晶体管称为“弱上拉”,当口线寄存器为1且引脚本身也为1时打开。此上拉提供基本驱动电流使准双向口输出为1。如果一个引脚输出为1而由外部装置下拉到低时,弱上拉关闭而“极弱上拉”维持开状态,为了把这个引脚强拉为低,外部装置必须有足够的灌电流能力使引脚上的电压降到门槛电压以下。第2个上拉晶体管,称为“极弱上拉”,当口线锁存为1时打开。当引脚悬空时,这个极弱的上拉源产生很弱的上拉电流将引脚上拉为高电平。第3个上拉晶体管称为“强上拉”。当口线锁存器由0到1跳变时,这个上拉用来加快准双向口由逻辑0到逻辑1转换。当发生这种情况时,强上拉打开约2个机器周期
27、以使引脚能够迅速地上拉到高电平。准双向口输出如下图所示。STC12C520系列单片机为3V器件,如果用户在引脚加上5V电压,将会有电流从引脚流向VDD,这样导致额外的功率消耗。因此,建议不要在准双向口模式中向3V单片机引脚施加5V电压,如使用的话,要加限流电阻,或用二极管做输入隔离,或用三极管做输出隔离。准双向口带有一个施密特触发输入以及一个干扰抑制电路2.推挽输出配置推挽输出配置的下拉结构与开漏输出以及准双向口的下拉结构相同,但当锁存器为1时提供持续的强上拉。推挽模式一般用于需要更大驱动电流的情况。推挽引脚配置如下图所示。.il/i':)濛尙嶽也可承受綸山低时3.仅为输入(高阻)配置
28、输入口配置如下图所示。输入口带有一个施密特触发输入以及一个干扰抑制电路。4开漏输出配置当口线锁存器为0时,开漏输出关闭所有上拉晶体管。当作为一个逻辑输出时,这种配置方式必须有外部上拉,一般通过电阻外接到VDD。这种方式的下拉与准双向口相同。输出口线配置如下图所示。开漏端口带有一个施密特触发输入以及一个干扰抑制电路一种典型三极管控制电路如果用弱上拉控制,建议加上拉电阻R1(3.3K10K),如果不加上拉电阻R1(3.3K10K),建议R2的值在15K以上,或用强推挽输出。STC12C5204AD系列单片机可编程计数器阵列(PCA)PCA含有一个特殊的16位定时器,有4个16位的捕获/比较模块与之
29、相连。每个模块可编程工作。在4种模式下:上升/下降沿捕获、软件定时器、高速输出或可调制脉冲输出。模块0连接到P3.7(CEXO/PCAO/PWMO),模块1连接到P3.5(CEX1/PCA1/PWM1),模块2连接到P2.0(CEX2/PCA2/PWM2),模块3连接到P2.4(CEX3/PCA3/PWM3)。寄存器CH和CL的内容是正在自由递增计数的16位PCA定时器的值。PCA定时器是4个模块的公共时间基准,可通过编程工作在:1/12振荡频率、1/2振荡频率、定时器0溢出或ECI脚的输入(P3.4)。定时器的计数源由CMODSFR的CPS1和CPSO位来确定(见CMOD特殊功能寄存器说明)
30、o可编程计数器阵列PCA定时器/计数器CMODSFR还有2个位与PCA相关。它们分别是:CIDL,空闲模式下允许停止PCA;ECF,置位时,使能PCA中断,当PCA定时器溢出将PCA计数溢出标志CF(CCONSFR)置位。CCONSFR包含PCA的运行控制位(CR)和PCA定时器标志(CF)以及各个模块的标志(CCF3/CCF2/CCF1/CCF0)。通过软件置位CR位(CCON.6)来运行PCA。CR位被清零时PCA关闭。当PCA计数器溢出时,CF位(CC0N.7)置位,如果CMOD寄存器的ECF位置位,就产生中断。CF位只可通过软件清除。CCON寄存器的位03是PCA各个模块的标志(位0对
31、应模块0,位1对应模块1,位2对应模块2,位3对应模块3),当发生匹配或比较时由硬件置位。这些标志也只能通过软件清除。所有模块共用一个中断向量。PCA的中断系统如图所示。PCA的每个模块都对应一个特殊功能寄存器。它们分别是:模块0对应CCAPM0,模块1对应CCAPM1,模块2对应CCAPM2,模块3对应CCAPM3。特殊功能寄存器包含了相应模块的工作模式控制位。当模块发生匹配或比较时,ECCFn位(CCAPMn.0,n=0,1,2,3由工作的模块决定)使能CCONSFR的CCFn标志来产生中断。PWM(CCAPMn.1)用来使能脉宽调制模式。当PCA计数值与模块的捕获/比较寄存器的值相匹配时
32、,如果TOG位(CCAPMn.2)置位,模块的CEXn输出将发生翻转。当PCA计数值与模块的捕获/比较寄存器的值相匹配时,如果匹配位MATn(CCAPMn.3)置位,CCON寄存器的CCFn位将被置位。CAPNn(CCAPMn.4)和CAPPn(CCAPMn.5)用来设置捕获输入的有效沿。CAPNn位使能下降沿有效,CAPPn位使能上升沿有效。如果两位都置位,则两种跳变沿都被使能,捕获可在两种跳变沿产生。通过置位CCAPMn寄存器的ECOMn位(CCAPMn.6)来使能比较器功能。每个PCA模块还对应另外两个寄存器,CCAPnH和CCAPnL。当出现捕获或比较时,它们用来保存16位的计数值。当PCA模块用在PWM模式中时,它们用来控制输出的占空比。PCA捕获模式要使一个PCA模块工作在捕获模式(下图),寄存器CCAPMn的两位(CAPNn和CAPPn)或其中任何一位必须置1。对模块的外部CEXn输入(CEX0/P3.7,CEX1/P3.5,CEX2/P2.0,CEX3/P2.4口)的跳变进行采样。当采样到有效跳变时,PCA硬件就将PCA计数器阵列寄存器(CH和CL)的值装
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 26年老年患者共病管理随访
- 医学26年:层流病房感染防控要点 查房课件
- 钳工孔加工技术
- 科技设计方案核心框架
- 国粹传承京剧课件
- 小班美术设计糖果课程架构
- 寒假安全教育
- 教育机构行政培训体系构建与实施
- 教育心理学发展简史
- 和谐教育主题班会设计实施路径
- 2025学年河北省名校协作体高三语文上学期12月考试卷附答案解析
- 2025湖南大学出版社有限责任公司招聘笔试历年常考点试题专练附带答案详解试卷2套
- 制造业产品研发流程优化方案
- 某法律服务公司车辆调度管理细则
- 2025年无人机教育普及与培训行业发展报告
- 2025国家电网考试历年真题库(附答案)
- 小散工程安全生产指引
- PLC控制节能洗衣机的系统设计
- 2025年中国铁路武汉局集团有限公司招聘99人(三)笔试参考题库附带答案详解
- 进修脑血管介入的工作汇报
- 风场行车安全培训内容课件
评论
0/150
提交评论