STC8F头文件.docx
- 文档编号:9340928
- 上传时间:2023-02-04
- 格式:DOCX
- 页数:22
- 大小:17.49KB
STC8F头文件.docx
《STC8F头文件.docx》由会员分享,可在线阅读,更多相关《STC8F头文件.docx(22页珍藏版)》请在冰豆网上搜索。
STC8F头文件
#ifndef__STC8F_H_
#define__STC8F_H_
/////////////////////////////////////////////////
//包含本头文件后,不用另外再包含"REG51.H"
//内核特殊功能寄存器
sfrACC=0xe0;
sfrB=0xf0;
sfrPSW=0xd0;
sbitCY=PSW^7;
sbitAC=PSW^6;
sbitF0=PSW^5;
sbitRS1=PSW^4;
sbitRS0=PSW^3;
sbitOV=PSW^2;
sbitP=PSW^0;
sfrSP=0x81;
sfrDPL=0x82;
sfrDPH=0x83;
sfrTA=0xae;
sfrDPS=0xe3;
sfrDPL1=0xe4;
sfrDPH1=0xe5;
//I/O口特殊功能寄存器
sfrP0=0x80;
sfrP1=0x90;
sfrP2=0xa0;
sfrP3=0xb0;
sfrP4=0xc0;
sfrP5=0xc8;
sfrP6=0xe8;
sfrP7=0xf8;
sfrP0M0=0x94;
sfrP0M1=0x93;
sfrP1M0=0x92;
sfrP1M1=0x91;
sfrP2M0=0x96;
sfrP2M1=0x95;
sfrP3M0=0xb2;
sfrP3M1=0xb1;
sfrP4M0=0xb4;
sfrP4M1=0xb3;
sfrP5M0=0xca;
sfrP5M1=0xc9;
sfrP6M0=0xcc;
sfrP6M1=0xcb;
sfrP7M0=0xe2;
sfrP7M1=0xe1;
sbitP00=P0^0;
sbitP01=P0^1;
sbitP02=P0^2;
sbitP03=P0^3;
sbitP04=P0^4;
sbitP05=P0^5;
sbitP06=P0^6;
sbitP07=P0^7;
sbitP10=P1^0;
sbitP11=P1^1;
sbitP12=P1^2;
sbitP13=P1^3;
sbitP14=P1^4;
sbitP15=P1^5;
sbitP16=P1^6;
sbitP17=P1^7;
sbitP20=P2^0;
sbitP21=P2^1;
sbitP22=P2^2;
sbitP23=P2^3;
sbitP24=P2^4;
sbitP25=P2^5;
sbitP26=P2^6;
sbitP27=P2^7;
sbitP30=P3^0;
sbitP31=P3^1;
sbitP32=P3^2;
sbitP33=P3^3;
sbitP34=P3^4;
sbitP35=P3^5;
sbitP36=P3^6;
sbitP37=P3^7;
sbitP40=P4^0;
sbitP41=P4^1;
sbitP42=P4^2;
sbitP43=P4^3;
sbitP44=P4^4;
sbitP45=P4^5;
sbitP46=P4^6;
sbitP47=P4^7;
sbitP50=P5^0;
sbitP51=P5^1;
sbitP52=P5^2;
sbitP53=P5^3;
sbitP54=P5^4;
sbitP55=P5^5;
sbitP56=P5^6;
sbitP57=P5^7;
sbitP60=P6^0;
sbitP61=P6^1;
sbitP62=P6^2;
sbitP63=P6^3;
sbitP64=P6^4;
sbitP65=P6^5;
sbitP66=P6^6;
sbitP67=P6^7;
sbitP70=P7^0;
sbitP71=P7^1;
sbitP72=P7^2;
sbitP73=P7^3;
sbitP74=P7^4;
sbitP75=P7^5;
sbitP76=P7^6;
sbitP77=P7^7;
//如下特殊功能寄存器位于扩展RAM区域
//访问这些寄存器,需先将P_SW2的BIT7设置为1,才可正常读写
#defineP0PU(*(unsignedcharvolatilexdata*)0xfe10)
#defineP1PU(*(unsignedcharvolatilexdata*)0xfe11)
#defineP2PU(*(unsignedcharvolatilexdata*)0xfe12)
#defineP3PU(*(unsignedcharvolatilexdata*)0xfe13)
#defineP4PU(*(unsignedcharvolatilexdata*)0xfe14)
#defineP5PU(*(unsignedcharvolatilexdata*)0xfe15)
#defineP6PU(*(unsignedcharvolatilexdata*)0xfe16)
#defineP7PU(*(unsignedcharvolatilexdata*)0xfe17)
#defineP0NCS(*(unsignedcharvolatilexdata*)0xfe18)
#defineP1NCS(*(unsignedcharvolatilexdata*)0xfe19)
#defineP2NCS(*(unsignedcharvolatilexdata*)0xfe1a)
#defineP3NCS(*(unsignedcharvolatilexdata*)0xfe1b)
#defineP4NCS(*(unsignedcharvolatilexdata*)0xfe1c)
#defineP5NCS(*(unsignedcharvolatilexdata*)0xfe1d)
#defineP6NCS(*(unsignedcharvolatilexdata*)0xfe1e)
#defineP7NCS(*(unsignedcharvolatilexdata*)0xfe1f)
//系统管理特殊功能寄存器
sfrPCON=0x87;
#defineSMOD0x80
#defineSMOD00x40
#defineLVDF0x20
#definePOF0x10
#defineGF10x08
#defineGF00x04
#definePD0x02
#defineIDL0x01
sfrAUXR=0x8e;
#defineT0x120x80
#defineT1x120x40
#defineUART_M0x60x20
#defineT2R0x10
#defineT2_CT0x08
#defineT2x120x04
#defineEXTRAM0x02
#defineS1ST20x01
sfrAUXR2=0x97;
#defineTXLNRX0x10
sfrBUS_SPEED=0xa1;
sfrP_SW1=0xa2;
sfrP_SW2=0xba;
#defineEAXFR0x80
sfrVOCTRL=0xbb;
sfrRSTCFG=0xff;
//如下特殊功能寄存器位于扩展RAM区域
//访问这些寄存器,需先将P_SW2的BIT7设置为1,才可正常读写
#defineCKSEL(*(unsignedcharvolatilexdata*)0xfe00)
#defineCLKDIV(*(unsignedcharvolatilexdata*)0xfe01)
#defineIRC24MCR(*(unsignedcharvolatilexdata*)0xfe02)
#defineXOSCCR(*(unsignedcharvolatilexdata*)0xfe03)
#defineIRC32KCR(*(unsignedcharvolatilexdata*)0xfe04)
//中断特殊功能寄存器
sfrIE=0xa8;
sbitEA=IE^7;
sbitELVD=IE^6;
sbitEADC=IE^5;
sbitES=IE^4;
sbitET1=IE^3;
sbitEX1=IE^2;
sbitET0=IE^1;
sbitEX0=IE^0;
sfrIE2=0xaf;
#defineET40x40
#defineET30x20
#defineES40x10
#defineES30x08
#defineET20x04
#defineESPI0x02
#defineES20x01
sfrIP=0xb8;
sbitPPCA=IP^7;
sbitPLVD=IP^6;
sbitPADC=IP^5;
sbitPS=IP^4;
sbitPT1=IP^3;
sbitPX1=IP^2;
sbitPT0=IP^1;
sbitPX0=IP^0;
sfrIP2=0xb5;
#definePI2C0x40
#definePCMP0x20
#definePX40x10
#definePPWMFD0x08
#definePPWM0x04
#definePSPI0x02
#definePS20x01
sfrIPH=0xb7;
#definePPCAH0x80
#definePLVDH0x40
#definePADCH0x20
#definePSH0x10
#definePT1H0x08
#definePX1H0x04
#definePT0H0x02
#definePX0H0x01
sfrIP2H=0xb6;
#definePI2CH0x40
#definePCMPH0x20
#definePX4H0x10
#definePPWMFDH0x08
#definePPWMH0x04
#definePSPIH0x02
#definePS2H0x01
sfrINTCLKO=0x8f;
#defineEX40x40
#defineEX30x20
#defineEX20x10
#defineT2CLKO0x04
#defineT1CLKO0x02
#defineT0CLKO0x01
sfrAUXINTIF=0xef;
#defineINT4IF0x40
#defineINT3IF0x20
#defineINT2IF0x10
#defineT4IF0x04
#defineT3IF0x02
#defineT2IF0x01
//定时器特殊功能寄存器
sfrTCON=0x88;
sbitTF1=TCON^7;
sbitTR1=TCON^6;
sbitTF0=TCON^5;
sbitTR0=TCON^4;
sbitIE1=TCON^3;
sbitIT1=TCON^2;
sbitIE0=TCON^1;
sbitIT0=TCON^0;
sfrTMOD=0x89;
#defineT1_GATE0x80
#defineT1_CT0x40
#defineT1_M10x20
#defineT1_M00x10
#defineT0_GATE0x08
#defineT0_CT0x04
#defineT0_M10x02
#defineT0_M00x01
sfrTL0=0x8a;
sfrTL1=0x8b;
sfrTH0=0x8c;
sfrTH1=0x8d;
sfrT4T3M=0xd1;
#defineT4R0x80
#defineT4_CT0x40
#defineT4x120x20
#defineT4CLKO0x10
#defineT3R0x08
#defineT3_CT0x04
#defineT3x120x02
#defineT3CLKO0x01
sfrT4H=0xd2;
sfrT4L=0xd3;
sfrT3H=0xd4;
sfrT3L=0xd5;
sfrT2H=0xd6;
sfrT2L=0xd7;
sfrTH4=0xd2;
sfrTL4=0xd3;
sfrTH3=0xd4;
sfrTL3=0xd5;
sfrTH2=0xd6;
sfrTL2=0xd7;
sfrWKTCL=0xaa;
sfrWKTCH=0xab;
#defineWKTEN0x80
sfrWDT_CONTR=0xc1;
#defineWDT_FLAG0x80
#defineEN_WDT0x20
#defineCLR_WDT0x10
#defineIDL_WDT0x08
//串行口特殊功能寄存器
sfrSCON=0x98;
sbitSM0=SCON^7;
sbitSM1=SCON^6;
sbitSM2=SCON^5;
sbitREN=SCON^4;
sbitTB8=SCON^3;
sbitRB8=SCON^2;
sbitTI=SCON^1;
sbitRI=SCON^0;
sfrSBUF=0x99;
sfrS2CON=0x9a;
#defineS2SM00x80
#defineS2ST40x40
#defineS2SM20x20
#defineS2REN0x10
#defineS2TB80x08
#defineS2RB80x04
#defineS2TI0x02
#defineS2RI0x01
sfrS2BUF=0x9b;
sfrS3CON=0xac;
#defineS3SM00x80
#defineS3ST40x40
#defineS3SM20x20
#defineS3REN0x10
#defineS3TB80x08
#defineS3RB80x04
#defineS3TI0x02
#defineS3RI0x01
sfrS3BUF=0xad;
sfrS4CON=0x84;
#defineS4SM00x80
#defineS4ST40x40
#defineS4SM20x20
#defineS4REN0x10
#defineS4TB80x08
#defineS4RB80x04
#defineS4TI0x02
#defineS4RI0x01
sfrS4BUF=0x85;
sfrSADDR=0xa9;
sfrSADEN=0xb9;
//ADC特殊功能寄存器
sfrADC_CONTR=0xbc;
#defineADC_POWER0x80
#defineADC_START0x40
#defineADC_FLAG0x20
sfrADC_RES=0xbd;
sfrADC_RESL=0xbe;
sfrADCCFG=0xde;
#defineADC_RESFMT0x20
//SPI特殊功能寄存器
sfrSPSTAT=0xcd;
#defineSPIF0x80
#defineWCOL0x40
sfrSPCTL=0xce;
#defineSSIG0x80
#defineSPEN0x40
#defineDORD0x20
#defineMSTR0x10
#defineCPOL0x08
#defineCPHA0x04
sfrSPDAT=0xcf;
//IAP/ISP特殊功能寄存器
sfrIAP_DATA=0xc2;
sfrIAP_ADDRH=0xc3;
sfrIAP_ADDRL=0xc4;
sfrIAP_CMD=0xc5;
#defineIAP_IDL0x00
#defineIAP_READ0x01
#defineIAP_WRITE0x02
#defineIAP_ERASE0x03
sfrIAP_TRIG=0xc6;
sfrIAP_CONTR=0xc7;
#defineIAPEN0x80
#defineSWBS0x40
#defineSWRST0x20
#defineCMD_FAIL0x10
sfrISP_DATA=0xc2;
sfrISP_ADDRH=0xc3;
sfrISP_ADDRL=0xc4;
sfrISP_CMD=0xc5;
sfrISP_TRIG=0xc6;
sfrISP_CONTR=0xc7;
//比较器特殊功能寄存器
sfrCMPCR1=0xe6;
#defineCMPEN0x80
#defineCMPIF0x40
#definePIE0x20
#defineNIE0x10
#definePIS0x08
#defineNIS0x04
#defineCMPOE0x02
#defineCMPRES0x01
sfrCMPCR2=0xe7;
#defineINVCMPO0x80
#defineDISFLT0x40
//PCA/PWM特殊功能寄存器
sfrCCON=0xd8;
sbitCF=CCON^7;
sbitCR=CCON^6;
sbitCCF3=CCON^3;
sbitCCF2=CCON^2;
sbitCCF1=CCON^1;
sbitCCF0=CCON^0;
sfrCMOD=0xd9;
#defineCIDL0x80
#defineECF0x01
sfrCL=0xe9;
sfrCH=0xf9;
sfrCCAPM0=0xda;
#defineECOM00x40
#defineCCAPP00x20
#defineCCAPN00x10
#defineMAT00x08
#defineTOG00x04
#definePWM00x02
#defineECCF00x01
sfrCCAPM1=0xdb;
#defineECOM10x40
#defineCCAPP10x20
#defineCCAPN10x10
#defineMAT10x08
#defineTOG10x04
#definePWM10x02
#defineECCF10x01
sfrCCAPM2=0xdc;
#defineECOM20x40
#defineCCAPP20x20
#defineCCAPN20x10
#defineMAT20x08
#defineTOG20x04
#definePWM20x02
#defineECCF20x01
sfrCCAPM3=0xdd;
#defineECOM30x40
#defineCCAPP30x20
#defineCCAPN30x10
#defineMAT30x08
#defineTOG30x04
#definePWM30x02
#defineECCF30x01
sfrCCAP0L=0xea;
sfrCCAP1L=0xeb;
sfrCCAP2L=0xec;
sfrCCAP3L=0xed;
sfrCCAP0H=0xfa;
sfrCCAP1H=0xfb;
sfrCCAP2H=0xfc;
sfrCCAP3H=0xfd;
sfrPCA_PWM0=0xf2;
sfrPCA_PWM1=0xf3;
sfrPCA_PWM2=0xf4;
sfrPCA_PWM3=0xf5;
//增强型PWM波形发生器特殊功能寄存器
sfrPWMCFG=0xf1;
#defineCBIF0x80
#defineETADC0x40
sfrPWMIF=0xf6;
#defineC7IF0x80
#defineC6IF0x40
#defineC5IF0x20
#defineC4IF0x10
#defineC3IF0x08
#defineC2IF0x04
#defineC1IF0x02
#defineC0IF0x01
sfrPWMFDCR=0xf7;
#defineINVCMP0x80
#defineINVIO0x40
#defineENFD0x20
#defineFLTFLIO0x10
#defineEFDI0x08
#defineFDCMP0x04
#defineFDIO0x02
#defineFDIF0x01
sfrPWMCR=0xfe;
#defineENPWM0x80
#defineECBI0x40
//如下特殊功能寄存器位于扩展RAM区域
//访问这些寄存器,需先将P_SW2的BIT7设置为1,才可正常读写
#definePWMC(*(unsignedintvolatilexdata*)0xfff0)
#definePWMCH(*(unsignedcharvolatilexdata*)0xfff0)
#definePWMCL(*(unsignedcharvolatilexdata*)0xfff1)
#definePWMCKS(*(unsignedcharvolatilexdata*)0xfff2)
#defineTADCP(*(unsignedcharvolatilex
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- STC8F 文件