STC12C5A60S2/AD/PWM系列单片机是宏晶科技生产的单时钟/机器周期(1T)的单片机,是高速/低功耗/超强抗干扰的新一代8051单片机,指令代码完全兼容传统8051,但速度快8-12倍。内部集成MAX810专用复位电路,2路PWM,8路高速10位A/D转换(250K/S),针对电机控制,强干扰场合
stc12c5a60s2必须要用要用stc12c5a.h。因为寄存器地址和51有些区别。LZ贴上错误提示。最常见的错误是没有sbit P00 = P0^0;这类语句。
关于头文件放置。建议放在工程所在目录下。然后程序前面加上 #include “stc12c5a.h”注意是双引号,不是角括号。
//单片机内核特殊功能寄存器
sfr ACC=0xE0;
sfr B =0xF0;
sfr PSW=0xD0;
sbit CY=PSW^7;
sbit AC=PSW^6;
sbit F0=PSW^5;
sbit RS1=PSW^4;
sbit RS0=PSW^3;
sbit OV=PSW^2;
sbit P=PSW^0;
sfr SP=0x81;
sfr DPL=0x82;
sfr DPH=0x83;
sfr PCON=0x87;
sfr AUXR=0x8E;
sfr AUXR1=0xA2;
sfr WAKE_CLKO=0x8F;
sfr CLK_DIV=0x97;
//单片机中断特殊功能寄存器
sfr IE=0XA8; sbit EA=IE^7;
sbit ELVD=IE^6;
sbit EADC=IE^5;
sbit ES=IE^4;
sbit ET1=IE^3;
sbit EX1=IE^2;
sbit ET0=IE^1;
sbit EX0=IE^0;
sfr IE2=0xAF;
sfr IP=0x88;
sbit PPCA=IP^7;
sbit PLVD=IP^6;
sbit PADC=IP^5;
sbit PS=IP^4;
sbit PT1=IP^3;
sbit PX1=IP^2;
sbit PT0=IP^1;
sbit PX0=IP^0;
sfr IPH=0xB7;
sfr IP2=0xB5;
sfr IPH2=0xB6;
sfr P0=0x80;
sfr P0M0=0x94;
sfr P0M1=0x93;
sfr P1=0x90;
sfr P1M0=0x92;
sfr P1M1=0x91;
sfr P1ASF=0x9D;
sfr P2=0xA0;
sfr P2M0=0x96;
sfr P2M1=0x95;
sfr P3=0xB0;
sfr P3M0=0xB2;
sfr P3M1=0xB1;
sfr P4=0xC0;
sfr P4M0=0xB4;
sfr P4M1=0xB3;
sfr P4SW=0xBB;
sfr P5=0xC8;
sfr P5M0=0xCA;
sfr P5M1=0xC9;
//单片机定时器特殊功能寄存器
sfr TCON=0x88;
sbit TF1=TCON^7;
sbit TR1=TCON^6;
sbit TF0=TCON^5;
sbit TR0=TCON^4;
sbit IE1=TCON^3;
sbit IT1=TCON^2;
sbit IE0=TCON^1;
sbit IT0=TCON^0;
sfr TMOD=0x89;
sfr TL0=0x8A;
sfr TH0=0x8C;
sfr TL1=0x8B;
sfr TH1=0x8D;
//单片机串行特殊功能寄存器
sfr SCON=0x98;
sbit SM0=SCON^7;
sbit SM1=SCON^6;
sbit SM2=SCON^5;
sbit REN=SCON^4;
sbit TB8=SCON^3;
sbit RB8=SCON^2;
sbit TI=SCON^1;
sbit RI=SCON^0;
sfr SBUF=0x99;
sfr SADEN=0xB9;
sfr SADDR=0xA9;
sfr S2CON=0x9A;
sfr S2BUF=0x9B;
sfr BRT=0x9C;
//单片机看门狗定时器特殊功能寄存器
sfr WDT_CONTR=0xC1;
//单片机PCM/PWM特殊功能寄存器
sfr CCON=0xD8;
sbit CF=CCON^7;
sbit CR=CCON^6;
sbit CCF1=CCON^1;
sbit CCF0=CCON^0;
sfr CMOD=0xD9;
sfr CL=0xE9; sfr CH=0xF9;
sfr CCAPM0=0xDA;
sfr CCAPM1=0xDB;
sfr CCAP0L=0xEA;
sfr CCAP0H=0xFA;
sfr CCAP1L=0xEB;
sfr CCAP1H=0xFB;
sfr PCA_PWM0=0xF2;
sfr PCA_PWM1=0xF3;
//单片机ADC特殊功能寄存器
sfr ADC_CONTR=0XBC;
sfr ADC_RES=0XBD;
sfr ADC_RESL=0xBE;
//单片机SPI特殊功能寄存器
sfr SPCTL=0xCE;
sfr SPSTAT=0xCD;
sfr SPDAT=0xCF;
//单片机IAP/ISP特殊功能寄存器
sfr IAP_DATA=0xC2;
sfr IAP_ADDRH=0xC3;
sfr IAP_ADDRL=0xC4;
sfr IAP_CMD=0xC5;
sfr IAP_TRIG=0xC6;
sfr IAP_CONTR=0xC7;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)