爱问 爱问共享资料 爱问分类
首页 >教育资料 >学术研究 >STC12C5A60S2芯片资料.pdf

STC12C5A60S2芯片资料.pdf举报

简介:

STC12C5A60S2芯片资料 单片机 STC12C5A60S2/AD/PWM 系列单片机是宏晶科技生产的单时钟/机器周期(1T)的单片机, 是高速/低功耗/超强抗干扰的新一代8051单片机,指令代码完全兼容传统8051,但速度快8-12 倍。内部集成MAX810专用复位电路,2路PWM,8路高速10位A/D转换(250K/S���ᦙ

;,即25􀐷万次􂅑�/􃀂秒����),􄪸 针对电机控制,强干扰场合

STC12C5A60S2系列单片机器件手册Tel:0755-82948411Fax:0755-82944243Mobile:13922805190(姚永平)宏晶STC官方网站:www.STCMCU.com1STC12C5A60S2系列1T8051单片机中文指南全球最大的8051单片机设计公司官方网站:www.STCMCU.comSTCMCULimited宏晶STC单片机官方网站:www.STCMCU.comUpdatedate:2011/1/15---高速,高可靠---低功耗,超低价---超超---抗静电,抗干扰---1个时钟/机器周期8051STC12C5A60S2系列单片机器件手册STC12C5A08S2,STC12C5A08ADSTC12C5A16S2,STC12C5A16ADSTC12C5A20S2,STC12C5A20ADSTC12C5A32S2,STC12C5A32ADSTC12C5A40S2,STC12C5A40ADSTC12C5A48S2,STC12C5A48ADSTC12C5A52S2,STC12C5A52ADSTC12C5A56S2,STC12C5A56ADSTC12C5A60S2,STC12C5A60ADSTC12C5A62S2,STC12C5A62AD全部中国大陆本土独立自主知识产权,技术处于全球领先水平,请全体中国人民支持,您的支持是中国大陆本土企业统一全球市场的有力保证.目录第1章STC12C5A60S2系列单片机总体介绍...................81.1STC12C5A60S2系列单片机简介...............................81.2STC12C5A60S2系列单片机的内部结构........................101.3STC12C5A60S2系列单片机管脚图............................111.4STC12C5A60S2系列单片机选型一览表........................131.5STC12C5A60S2系列单片机最小应用系统......................151.6STC12C5A60S2系列在系统可编程(ISP)典型应用线路图.........171.7STC12C5A60S2系列管脚说明................................191.8STC12C5A60S2系列单片机封装尺寸图........................221.9STC12C5A60S2系列单片机命名规则..........................271.10每个单片机具有全球唯一身份证号码(ID号)..................28第2章时钟,省电模式及复位.............................312.1STC12C5A60S2系列单片机的时钟............................312.1.1STC12C5A60S2系列单片机内部/外部工作时钟可选...................................312.1.2时钟分频及分频寄存器................................................................................322.1.3如何知道单片机内部R/C振荡频率(内部时钟频率).....................................332.1.4可编程时钟输出..........................................................................................362.2STC12C5A60S2系列单片机的省电模式........................412.2.1低速模式.....................................................................................................432.2.2空闲模式.....................................................................................................442.2.3掉电模式/停机模式.....................................................................................442.3复位.....................................................502.3.1外部RST引脚复位(第一复位功能脚)..........................................................502.3.2外部低压检测复位(高可靠复位,新增第二复位功能脚RST2复位).............502.3.3外部低压检测若不作第二复位功能时,可作外部低压检测中断..................522.3.4软件复位.....................................................................................................562.3.5上电复位/掉电复位.....................................................................................562.3.6MAX810专用复位电路................................................................................572.3.7看门狗(WDT)复位.......................................................................................572.3.8冷启动复位和热启动复位............................................................................61第3章片内存储器和特殊功能寄存器(SFRs)...................................623.1程序存储器...............................................623.2数据存储器(SRAM).................................................................................633.2.1内部RAM....................................................................................................633.2.2内部扩展RAM.............................................................................................653.2.3外部扩展的64KB数据存储器(片外RAM)....................................................733.3特殊功能寄存器(SFRs)............................................................................76第4章.STC12C5A60S2系列单片机的I/O口结构...............834.1I/O口各种不同的工作模式及配置介绍.........................834.2STC12C5A60S2系列单片机P4/P5口的使用.....................884.3I/O口各种不同的工作模式结构框图...........................904.3.1准双向口输出配置................................................................................................904.3.2强推挽输出配置....................................................................................................914.3.3仅为输入(高阻)配置................................................................................914.3.4开漏输出配置(若外上拉电阻,也可读)..................................................914.4一种典型三极管控制电路...................................934.5典型发光二极管控制电路...................................934.6混合电压供电系统3V/5V器件I/O口互连.......................934.7如何让I/O口上电复位时为低电平.............................944.8PWM输出时I/O口的状态....................................954.9I/O口直接驱动LED数码管应用线路图.........................964.10I/O口直接驱动LCD应用线路图..............................974.11A/D做按键扫描应用线路图.................................98第5章.指令系统.........................................995.1寻址方式.................................................995.1.1立即寻址.....................................................................................................995.1.2直接寻址.....................................................................................................995.1.3间接寻址.....................................................................................................995.1.4寄存器寻址................................................................................................1005.1.5相对寻址...................................................................................................1005.1.6变址寻址...................................................................................................1005.1.7位寻址.......................................................................................................1005.2指令系统分类总结........................................1015.3传统8051单片机的指令定义................................106第6章.中断系统........................................1436.1中断结构................................................1456.2中断寄存器..............................................1476.3中断优先级..............................................1556.4中断处理................................................1566.5外部中断................................................1576.6中断测试程序............................................1586.6.1外部中断0(INT0)的测试程序.....................................................................1586.6.2外部中断1(INT1)的测试程序.....................................................................1626.6.3定时器0中断(下降沿中断,可用于唤醒掉电模式)的测试程序..................1666.6.4定时器1中断(下降沿中断,可用于唤醒掉电模式)的测试程序..................1686.6.5RxD中断(RxD/P3.0下降沿中断,可用于唤醒掉电模式)的测试程序.........1706.6.6低压检测LVD中断(可用于唤醒掉电模式)的测试程序..............................1726.6.7PCA模块中断(可用于唤醒掉电模式)的测试程序......................................175第7章.定时器/计数器...................................1797.1定时器/计数器的相关寄存器...............................1797.2定时器/计数器0工作模式..................................1847.2.1模式0(13位定时器/计数器)........................................................................1847.2.2模式1(16位定时器/计数器)........................................................................1857.2.3模式2(8位自动重装模式)...........................................................................1897.2.4模式3(两个8位计数器)...............................................................................1927.3定时器/计数器1工作模式..................................1937.3.1模式0(13位定时器/计数器)........................................................................1937.3.2模式1(16位定时器/计数器)........................................................................1947.3.3模式2(8位自动重装模式)...........................................................................1987.4可编程时钟输出及测试程序(C程序和汇编程序)...............2017.4.1定时器0的可编程时钟输出的测试程序......................................................2047.4.2定时器1的可编程时钟输出的测试程序......................................................2067.4.3独立波特率发生器的可编程时钟输出的测试程序......................................2087.5古老Intel8051单片机定时器0/1的应用举例....................210第8章.串行口通信......................................2178.1串行口1的相关寄存器.....................................2178.2串行口1工作模式.........................................2238.2.1串行口1工作模式0:同步移位寄存器........................................................2238.2.2串行口1工作模式1:8位UART,波特率可变...............................................2258.2.3串行口1工作模式2:9位UART,波特率固定...............................................2278.2.4串行口1工作模式3:9位UART,波特率可变...............................................2298.3串行通信中波特率的设置..................................2318.4串行口1的测试程序.......................................2368.5串行口2的相关寄存器.....................................2428.6串行口2工作模式.........................................2488.7串行口2的测试程序.......................................2508.8双机通信.............................................2568.9多机通信.............................................267第9章.STC12C5A60S2系列单片机的A/D转换器.............2739.1A/D转换器的结构.........................................2739.2与A/D转换相关的寄存器...................................2759.3A/D转换典型应用线路.....................................2809.4A/D做按键扫描应用线路图.................................2819.5A/D转换模块的参考电压源.................................2829.6A/D转换测试程序(C程序和汇编程序).......................2839.6.1A/D转换测试程序(ADC中断方式)............................................................2839.6.2A/D转换测试程序(ADC查询方式)............................................................289第10章.STC12C5A60S2系列单片机PCA/PWM应用..........29510.1与PCA/PWM应用有关的特殊功能寄存器....................29510.2PCA/PWM模块的结构....................................30110.3PCA模块的工作模式.....................................30310.3.1捕获模式............................................................................................................30310.3.216位软件定时器模式........................................................................................30410.3.3高速输出模式....................................................................................................30510.3.4脉宽调节模式(PWM)........................................................................................30610.4用PCA功能扩展外部中断的示例程序(C程序和汇编程序)......30810.5用PCA功能实现定时器的示例程序(C程序和汇编程序)........31210.6PCA输出高速脉冲的示例程序(C程序和汇编程序)............31610.7PCA输出PWM的示例程序(C程序和汇编程序)...............32010.8利用PWM实现D/A功能的典型应用线路图...................324第11章.同步串行外围接口(SPI接口)......................32511.1与SPI功能模块相关的特殊功能寄存器......................32511.2SPI接口的结构..........................................32811.3SPI接口的数据通信......................................32911.3.1SPI接口的数据通信方式..........................................................................33011.3.2对SPI进行配置.........................................................................................33211.3.3作为主机/从机时的额外注意事项............................................................33311.3.4通过SS改变模式......................................................................................33411.3.5写冲突.....................................................................................................33411.3.6数据模式..................................................................................................33511.4适用单主单从系统的SPI功能测试程序......................33711.4.1中断方式..................................................................................................33711.4.2查询方式..................................................................................................34311.5适用互为主从系统的SPI功能测试程序......................34911.5.1中断方式..................................................................................................34911.5.2查询方式..................................................................................................355第12章.STC12C5A60S2系列单片机EEPROM的应用.........36112.1IAP及EEPROM新增特殊功能寄存器介绍....................36112.2STC12C5A60S2系列单片机EEPROM空间大小及地址..........36512.3IAP及EEPROM汇编简介..................................36712.4EEPROM测试程序.......................................371第13章.STC12系列单片机开发/编程工具说明...............37913.1在系统可编程(ISP)原理,官方演示工具使用说明.............37913.1.1在系统可编程(ISP)原理使用说明.............................................................37913.1.2STC12C5A60S2系列在系统可编程(ISP)典型应用线路图.........................38013.1.3电脑端的ISP控制软件界面使用说明........................................................38213.1.4宏晶科技的ISP下载编程工具硬件使用说明.............................................38413.1.5若无RS-232转换器,如何用宏晶的ISP下载板做RS-232通信转换............38513.2编译器/汇编器,编程器,仿真器..........................38613.3自定义下载演示程序(实现不停电下载).....................388Tel:0755-82948411Fax:0755-82944243Mobile:13922805190(姚永平)宏晶STC官方网站:www.STCMCU.com7STC12C5A60S2系列1T8051单片机中文指南全球最大的8051单片机设计公司官方网站:www.STCMCU.comSTCMCULimited附录A:汇编语言编程...................................392附录B:C语言编程......................................414附录C:STC12C5A60S2系列单片机电气特性...............424附录D:内部常规256字节RAM间接寻址测试程序...........426附录E:用串口扩展I/O接口..............................428附录F:利用STC单片机普通I/O驱动LCD显示..............431附录G:一个I/O口驱动发光二极管并扫描按键..............438附录H:STC12系列单片机取代传统8051注意事项...........439附录I:如何采购........................................443Tel:0755-82948411Fax:0755-82944243Mobile:13922805190(姚永平)宏晶STC官方网站:www.STCMCU.com8STC12C5A60S2系列1T8051单片机中文指南全球最大的8051单片机设计公司官方网站:www.STCMCU.comSTCMCULimited第1章STC12C5A60S2系列单片机总体介绍1.1.STC12C5A60S2系列单片机简介STC12C5A60S2/AD/PWM系列单片机是宏晶科技生产的单时钟/机器周期(1T)的单片机,是高速/低功耗/超抗干扰的新一代8051单片机,指令代码完全兼容传统8051,但速度快8-12倍。内部集成MAX810专用复位电路,2路PWM,8路高速10位A/D转换(250K/S,即25/),,即25/),),对电机控制,干扰场合。1.增型8051CPU,1T,单时钟/机器周期,指令代码完全兼容传统80512.工作电压:STC12C5A60S2系列工作电压:5.5V-3.5V(5V单片机)STC12LE5A60S2系列工作电压:3.6V-2.2V(3V单片机)3.工作频率范围:0~35MHz,相当于普通8051的0~420MHz4.用户应用程序空间8K/16K/20K/32K/40K/48K/52K/60K/62K字节......5.片上集成1280字节RAM6.通用I/O口(36/40/44个),复位后为:准双向口/弱上拉(普通8051传统I/O口)可设置成四种模式:准双向口/弱上拉,推挽/上拉,仅为输入/高阻,开漏推挽/上拉,仅为输入/高阻,开漏推挽/上拉,仅为输入/高阻,开漏每个I/O口驱动能力均可达到20mA,但整个芯片最大不要超过120mA7.ISP(在系统可编程)/IAP(在应用可编程),无需专用编程器,无需专用仿真器可通过串口(P3.0/P3.1)直接下载用户程序,数即可完成一片8.有EEPROM功能(STC12C5A62S2/AD/PWM无内部EEPROM)9.看门狗10.内部集成MAX810专用复位电路(外部晶体12M以下时,复位脚可直接1K电阻到地)11.外部掉电检测电路:在P4.6口有一个低压门槛比较器5V单片机为1.33V,误差为5%,3.3V单片机为1.31V,误差为3%12.时钟源:外部高精度晶体/时钟,内部R/C振荡器(温漂为5%到10%以内)用户在下载用户程序时,可选择是使用内部R/C振荡器还是外部晶体/时钟常温下内部R/C振荡器频率为:5.0V单片机为:11MHz~17MHz3.3V单片机为:8MHz~12MHz精度要求不高时,可选择使用内部时钟,但因为有制造误差和温漂,以实际测试为准13.共4个16位定时器两个与传统8051兼容的定时器/计数器,16位定时器T0和T1,没有定时器2,但有独立波特率发生器做串行通讯的波特率发生器,再上2路PCA模块可再实现2个16位定时器14.3个时钟输出口,可由T0的溢出在P3.4/T0输出时钟,可由T1的溢出在P3.5/T1输出时钟,独立波特率发生器可以在P1.0口输出时钟15.外部中断I/O口7路,传统的下降沿中断或低电平触发中断,并新增支持上升沿中断的PCA模块,,PowerDown模式可由外部中断唤醒,,INT0/P3.2,INT1/P3.3,T0/P3.4,T1/P3.5,RxD/P3.0,CCP0/P1.3(也可通过寄存器设置到P4.2),CCP1/P1.4(也可通过寄存器设置到P4.3)Administrator矩形Tel:0755-82948411Fax:0755-82944243Mobile:13922805190(姚永平)宏晶STC官方网站:www.STCMCU.com9STC12C5A60S2系列1T8051单片机中文指南全球最大的8051单片机设计公司官方网站:www.STCMCU.comSTCMCULimited16.PWM(2路)/PCA(可编程计数器阵列,2路)---也可用来当2路D/A使用---也可用来再实现2个定时器---也可用来再实现2个外部中断(上升沿中断/下降沿中断均可分别或同时支持)17.A/D转换,10位精度ADC,共8路,转换速度可达250K/S(每钟25)18.通用全双工异步串行口(UART),由于STC12系列是高速的8051,可再用定时器或PCA软件,可再用定时器或PCA软件可再用定时器或PCA软件实现多串口19.STC12C5A60S2系列有双串口,后缀有S2标志的才有双串口,RxD2/P1.2(可通过寄存器设置到P4.2),TxD2/P1.3(可通过寄存器设置到P4.3)20.工作温度范围:-40~+85(工业级)/0~75(商业级)21.封装:LQFP-48,LQFP-44,PDIP-40,PLCC-44,QFN-40I/O口不够时,可用2到3根普通I/O口线外接74HC164/165/595(均可级联)来扩展I/O口,还可用A/D做按键扫描来节省I/O口,或用双CPU,三线通信,还多了串口。Tel:0755-82948411Fax:0755-82944243Mobile:13922805190(姚永平)宏晶STC官方网站:www.STCMCU.com10STC12C5A60S2系列1T8051单片机中文指南全球最大的8051单片机设计公司官方网站:www.STCMCU.comSTCMCULimitedSTC12C5A60S2系列内部结构框图程序存储器(Flash)程序计数器(PC)PC)堆栈指ISP/IAP地址生成器定时器0/1Port0,2,3,4,5锁存器Port0,2,3,4,5驱动器P0,P2,P3,P4,P5Port1锁存器Port1驱动器P1.0~P1.7ADCP1.0~P1.78B寄存器RAM256字节RAM地址寄存器PCASPIACCTMP2TMP1ALUPSWWDTControlUnitXTAL2XTAL1RESETAUX-RAM1024字节串口2LVD/LVR1.2STC12C5A60S2系列单片机的内部结构STC12C5A60S2系列单片机的内部结构框图如下图所示。STC12C5A60S2单片机中包含中央处理器(CPU)、程序存储器(Flash)、数据存储器(SRAM)、定时/计数器、UART串口、串口2、I/O接口、高速A/D转换、SPI接口、PCA、看门狗及片内R/C振荡器和外部晶体振荡电路等模块。STC12C5A60S2系列单片机几乎包含了数据采集和控制中所需的所有单元模块,可称得上一个片上系统。串口1Tel:0755-82948411Fax:0755-82944243Mobile:13922805190(姚永平)宏晶STC官方网站:www.STCMCU.com11STC12C5A60S2系列1T8051单片机中文指南全球最大的8051单片机设计公司官方网站:www.STCMCU.comSTCMCULimited1.3.STC12C5A60S2系列单片机管单片机管管所有封装形式均满足欧盟RoHS要求12345678910111213141516171819204039383736353433323130292827262524232221VccALE/P4.5NA/P4.4P4.7/RSTTxD/P3.1XTAL2XTAL1GndWR/P3.6RD/P3.7INT/RxD/P3.0CLKOUT0/INT/T0/P3.4CLKOUT1/INT/T1/P3.5INT1/P3.3INT0/P3.2P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7EX_LVD/P4.6/RST2P2.7/A15P2.6/A14P2.5/A13P2.4/A12P2.3/A11P2.2/A10P2.1/A9P2.0/A8CLKOUT2/ADC0/P1.0ADC1/P1.1RxD2/ECI/ADC2/P1.2TxD2/CPP0/ADC3/P1.3SS/CPP1/ADC4/P1.4MOSI/ADC5/P1.5MISO/ADC6/P1.6SCLK/ADC7/P1.733323130292827262524231234567891011P4.7/RSTTxD/P3.1INT/RxD/P3.0INT0/P3.2INT1/P3.3CLKOUT0/INT/T0/P3.4CLKOUT1/INT/T1/P3.5ALE/P4.5NA/P4.4VccXTAL2XTAL1GndP3.6/WRP3.7/RDP0.4P0.5P0.6EX_LVD/P4.6/RST2P4.1/ECI/MOSIP2.7/A15P2.6/A14P2.5/A13P0.7MOSI/ADC5/P1.5MISO/ADC6/P1.6SCLK/ADC7/P1.7SCLK/TxD2/CCP1/P4.3SS/CCP1/ADC4/P1.4TxD2/CCP0/ADC3/P1.3RxD2/ECI/ADC2/P1.2ADC1/P1.1CLKOUT2/ADC0/P1.0P0.0P0.1P0.2P0.3MISO/RxD2/CCP0/P4.2P4.0/SSP2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P0.4P0.5P0.6P0.7EX_LVD/P4.6/RST2P4.1/ECI/MOSIALE/P4.5NA/P4.4P2.7/A15P2.6/A14P2.5/A13P5.1P5.3MOSI/ADC5/P1.5MISO/ADC6/P1.6SCLK/ADC7/P1.7P4.7/RSTSCLK/TxD2/CCP1/P4.3TxD/P3.1P5.2SS/CCP1/ADC4/P1.4TxD2/CCP0/ADC3/P1.3RxD2/ECI/ADC2/P1.2ADC1/P1.1ADC0/CLKOUT2/P1.0MISO/RxD2/CCP0/P4.2VCCP0.0P0.1P0.2P0.3P5.0123456789101112363534333231302928272625INT/RxD/P3.0INT0/P3.2INT1/P3.3CLKOUT0/INT/T0/P3.4CLKOUT1/INT/T1/P3.5LQFP-48STC12C5A60S2PDIP-40,STC12C5A60S2,增加了P4口LQFP-44STC12C5A60S234353637383940414243442221201918171615141312373839404142434445464748242322211019181716151413XTAL2XTAL1GndP3.6/WRP3.7/RDP4.0/SSP2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12增加了P4/P5口并可位寻址增加了P4口并可位寻址CCP:是英文单词的缩写Capture(捕获),Compare(比较),PWM(脉宽调制)Tel:0755-82948411Fax:0755-82944243Mobile:13922805190(姚永平)宏晶STC官方网站:www.STCMCU.com12STC12C5A60S2系列1T8051单片机中文指南全球最大的8051单片机设计公司官方网站:www.STCMCU.comSTCMCULimitedPLCC-44STC12C5A60S23938373635343332313029789101112131415161718192021222324252627286543214443424140ALE/P4.5NA/P4.4P0.4P0.5P0.6EX_LVD/P4.6/RST2P4.1/ECI/MOSIP2.7/A15P2.6/A14P2.5/A13P0.7XTAL2XTAL1GndWR/P3.6RD/P3.7SS/P4.0A8/P2.0A9/P2.1A10/P2.2A11/P2.3A12/P2.4P4.7/RSTTxD/P3.1INT/RxD/P3.0INT0/P3.2INT1/P3.3CLKOUT0/INT/T0/P3.4CLKOUT1/INT/T1/P3.5MOSI/ADC5/P1.5MISO/ADC6/P1.6SCLK/ADC7/P1.7SCLK/TxD2/CCP1/P4.3VccP1.4/ADC4/CCP1/SSP1.3/ADC3/CCP0/TxD2P1.2/ADC2/ECI/RxD2P1.1/ADC1P1.0/ADC0/C

相关资料推荐

  • 名称/格式
  • 下载次数
  • 资料大小

用户评论

0/200
暂无评论

资料阅读排行

该用户的其它资料

关闭

请选择举报的类型

关闭

提示

提交成功!

感谢您对爱问共享资料的支持,我们将尽快核实并处理您的举报信息。

关闭

提示

提交失败!

您的举报信息提交失败,请重试!

关闭

提示

重复举报!

亲爱的用户!感觉您对爱问共享资料的支持,请勿重复举报噢!

收藏
资料评价:

所需积分:2 立即下载
返回
顶部
举报
资料
关闭

温馨提示

感谢您对爱问共享资料的支持,精彩活动将尽快为您呈现,敬请期待!