[C51嵌入式开发实例]
STC12C4052AD管脚图
STC12C5A60S2 管脚图
STC单片机头文件【51CTO-->单片机-->STC单片机官方头文件】
下载链接 链接: 密码:a0re
把STC12C5A60S2.H 、STC12C2052AD.H头文件放到 C:\Keil\C51\INC\
#include// 通用89C51头文件#include // 通用89C52头文件#include // STC11Fxx或者STC11Lxx系列单片机头文件 #include // STC12Cx052 或STC12Cx052AD 系列单片机头文件#include // STC12C5A60S2系列单片机头文件
STC12C5A60S2.H
#ifndef __STC12C5A60S2_H_#define __STC12C5A60S2_H_///--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机内核特殊功能寄存器 C51 Core SFRs// 7 6 5 4 3 2 1 0 Reset Valuesfr ACC = 0xE0; //Accumulator 0000,0000sfr B = 0xF0; //B Register 0000,0000sfr PSW = 0xD0; //Program Status Word CY AC F0 RS1 RS0 OV F1 P 0000,0000//-----------------------------------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; //Stack Pointer 0000,0111sfr DPL = 0x82; //Data Pointer Low Byte 0000,0000sfr DPH = 0x83; //Data Pointer High Byte 0000,0000//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机系统管理特殊功能寄存器// 7 6 5 4 3 2 1 0 Reset Valuesfr PCON = 0x87; //Power Control SMOD SMOD0 LVDF POF GF1 GF0 PD IDL 0001,0000// 7 6 5 4 3 2 1 0 Reset Valuesfr AUXR = 0x8E; //Auxiliary Register T0x12 T1x12 UART_M0x6 BRTR S2SMOD BRTx12 EXTRAM S1BRS 0000,0000//-----------------------------------sfr AUXR1 = 0xA2; //Auxiliary Register 1 - PCA_P4 SPI_P4 S2_P4 GF2 ADRJ - DPS 0000,0000/*PCA_P4: 0, 缺省PCA 在P1 口 1,PCA/PWM 从P1 口切换到P4 口: ECI 从P1.2 切换到P4.1 口, PCA0/PWM0 从P1.3 切换到P4.2 口 PCA1/PWM1 从P1.4 切换到P4.3 口SPI_P4: 0, 缺省SPI 在P1 口 1,SPI 从P1 口切换到P4 口: SPICLK 从P1.7 切换到P4.3 口 MISO 从P1.6 切换到P4.2 口 MOSI 从P1.5 切换到P4.1 口 SS 从P1.4 切换到P4.0 口S2_P4: 0, 缺省UART2 在P1 口 1,UART2 从P1 口切换到P4 口: TxD2 从P1.3 切换到P4.3 口 RxD2 从P1.2 切换到P4.2 口GF2: 通用标志位ADRJ: 0, 10 位A/D 转换结果的高8 位放在ADC_RES 寄存器, 低2 位放在ADC_RESL 寄存器 1,10 位A/D 转换结果的最高2 位放在ADC_RES 寄存器的低2 位, 低8 位放在ADC_RESL 寄存器DPS: 0, 使用缺省数据指针DPTR0 1,使用另一个数据指针DPTR1*///-----------------------------------sfr WAKE_CLKO = 0x8F; //附加的 SFR WAK1_CLKO/* 7 6 5 4 3 2 1 0 Reset Value PCAWAKEUP RXD_PIN_IE T1_PIN_IE T0_PIN_IE LVD_WAKE _ T1CLKO T0CLKO 0000,0000Bb7 - PCAWAKEUP : PCA 中断可唤醒 powerdown。b6 - RXD_PIN_IE : 当 P3.0(RXD) 下降沿置位 RI 时可唤醒 powerdown(必须打开相应中断)。b5 - T1_PIN_IE : 当 T1 脚下降沿置位 T1 中断标志时可唤醒 powerdown(必须打开相应中断)。b4 - T0_PIN_IE : 当 T0 脚下降沿置位 T0 中断标志时可唤醒 powerdown(必须打开相应中断)。b3 - LVD_WAKE : 当 CMPIN 脚低电平置位 LVD 中断标志时可唤醒 powerdown(必须打开相应中断)。b2 - b1 - T1CLKO : 允许 T1CKO(P3.5) 脚输出 T1 溢出脉冲,Fck1 = 1/2 T1 溢出率b0 - T0CLKO : 允许 T0CKO(P3.4) 脚输出 T0 溢出脉冲,Fck0 = 1/2 T1 溢出率*///-----------------------------------sfr CLK_DIV = 0x97; //Clock Divder - - - - - CLKS2 CLKS1 CLKS0 xxxx,x000//-----------------------------------sfr BUS_SPEED = 0xA1; //Stretch register - - ALES1 ALES0 - RWS2 RWS1 RWS0 xx10,x011/*ALES1 and ALES0:00 : The P0 address setup time and hold time to ALE negative edge is one clock cycle01 : The P0 address setup time and hold time to ALE negative edge is two clock cycles.10 : The P0 address setup time and hold time to ALE negative edge is three clock cycles. (default)11 : The P0 address setup time and hold time to ALE negative edge is four clock cycles.RWS2,RWS1,RWS0: 000 : The MOVX read/write pulse is 1 clock cycle. 001 : The MOVX read/write pulse is 2 clock cycles. 010 : The MOVX read/write pulse is 3 clock cycles. 011 : The MOVX read/write pulse is 4 clock cycles. (default) 100 : The MOVX read/write pulse is 5 clock cycles. 101 : The MOVX read/write pulse is 6 clock cycles. 110 : The MOVX read/write pulse is 7 clock cycles. 111 : The MOVX read/write pulse is 8 clock cycles.*///--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机中断特殊功能寄存器//有的中断控制、中断标志位散布在其它特殊功能寄存器中,这些位在位地址中定义//其中有的位无位寻址能力,请参阅 新一代 1T 8051系列 单片机中文指南// 7 6 5 4 3 2 1 0 Reset Valuesfr IE = 0xA8; //中断控制寄存器 EA ELVD EADC ES ET1 EX1 ET0 EX0 0x00,0000//-----------------------sbit EA = IE^7;sbit ELVD = IE^6; //低压监测中断允许位sbit EADC = IE^5; //ADC 中断允许位sbit ES = IE^4;sbit ET1 = IE^3;sbit EX1 = IE^2;sbit ET0 = IE^1;sbit EX0 = IE^0;//-----------------------sfr IE2 = 0xAF; //Auxiliary Interrupt - - - - - - ESPI ES2 0000,0000B//-----------------------// 7 6 5 4 3 2 1 0 Reset Valuesfr IP = 0xB8; //中断优先级低位 PPCA PLVD PADC PS PT1 PX1 PT0 PX0 0000,0000//--------sbit PPCA = IP^7; //PCA 模块中断优先级sbit PLVD = IP^6; //低压监测中断优先级sbit PADC = IP^5; //ADC 中断优先级sbit PS = IP^4;sbit PT1 = IP^3;sbit PX1 = IP^2;sbit PT0 = IP^1;sbit PX0 = IP^0;//-----------------------// 7 6 5 4 3 2 1 0 Reset Valuesfr IPH = 0xB7; //中断优先级高位 PPCAH PLVDH PADCH PSH PT1H PX1H PT0H PX0H 0000,0000sfr IP2 = 0xB5; // - - - - - - PSPI PS2 xxxx,xx00sfr IPH2 = 0xB6; // - - - - - - PSPIH PS2H xxxx,xx00//-----------------------//新一代 1T 8051系列 单片机I/O 口特殊功能寄存器// 7 6 5 4 3 2 1 0 Reset Valuesfr P0 = 0x80; //8 bitPort0 P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0 1111,1111sbit P00 = P0^0;sbit P01 = P0^1;sbit P02 = P0^2;sbit P03 = P0^3;sbit P04 = P0^4;sbit P05 = P0^5;sbit P06 = P0^6;sbit P07 = P0^7;sfr P0M0 = 0x94; // 0000,0000sfr P0M1 = 0x93; // 0000,0000sfr P1 = 0x90; //8 bitPort1 P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 1111,1111sbit P10 = P1^0;sbit P11 = P1^1;sbit P12 = P1^2;sbit P13 = P1^3;sbit P14 = P1^4;sbit P15 = P1^5;sbit P16 = P1^6;sbit P17 = P1^7;sfr P1M0 = 0x92; // 0000,0000sfr P1M1 = 0x91; // 0000,0000sfr P1ASF = 0x9D; //P1 analog special functionsfr P2 = 0xA0; //8 bitPort2 P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0 1111,1111sbit P20 = P2^0;sbit P21 = P2^1;sbit P22 = P2^2;sbit P23 = P2^3;sbit P24 = P2^4;sbit P25 = P2^5;sbit P26 = P2^6;sbit P27 = P2^7;sfr P2M0 = 0x96; // 0000,0000sfr P2M1 = 0x95; // 0000,0000sfr P3 = 0xB0; //8 bitPort3 P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0 1111,1111sbit P30 = P3^0;sbit P31 = P3^1;sbit P32 = P3^2;sbit P33 = P3^3;sbit P34 = P3^4;sbit P35 = P3^5;sbit P36 = P3^6;sbit P37 = P3^7;sfr P3M0 = 0xB2; // 0000,0000sfr P3M1 = 0xB1; // 0000,0000sfr P4 = 0xC0; //8 bitPort4 P4.7 P4.6 P4.5 P4.4 P4.3 P4.2 P4.1 P4.0 1111,1111sbit P40 = P4^0;sbit P41 = P4^1;sbit P42 = P4^2;sbit P43 = P4^3;sbit P44 = P4^4;sbit P45 = P4^5;sbit P46 = P4^6;sbit P47 = P4^7;sfr P4M0 = 0xB4; // 0000,0000sfr P4M1 = 0xB3; // 0000,0000// 7 6 5 4 3 2 1 0 Reset Valuesfr P4SW = 0xBB; //Port-4 switch - LVD_P4.6 ALE_P4.5 NA_P4.4 - - - - x000,xxxxsfr P5 = 0xC8; //8 bitPort5 - - - - P5.3 P5.2 P5.1 P5.0 xxxx,1111sbit P50 = P5^0;sbit P51 = P5^1;sbit P52 = P5^2;sbit P53 = P5^3;sfr P5M0 = 0xCA; // 0000,0000sfr P5M1 = 0xC9; // 0000,0000//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机定时器特殊功能寄存器// 7 6 5 4 3 2 1 0 Reset Valuesfr TCON = 0x88; //T0/T1 Control TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0 0000,0000//-----------------------------------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; //T0/T1 Modes GATE1 C/T1 M1_1 M1_0 GATE0 C/T0 M0_1 M0_0 0000,0000sfr TL0 = 0x8A; //T0 Low Byte 0000,0000sfr TH0 = 0x8C; //T0 High Byte 0000,0000sfr TL1 = 0x8B; //T1 Low Byte 0000,0000sfr TH1 = 0x8D; //T1 High Byte 0000,0000//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机串行口特殊功能寄存器// 7 6 5 4 3 2 1 0 Reset Valuesfr SCON = 0x98; //Serial Control SM0/FE SM1 SM2 REN TB8 RB8 TI RI 0000,0000//-----------------------------------sbit SM0 = SCON^7; //SM0/FEsbit 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; //Serial Data Buffer xxxx,xxxxsfr SADEN = 0xB9; //Slave Address Mask 0000,0000sfr SADDR = 0xA9; //Slave Address 0000,0000//-----------------------------------// 7 6 5 4 3 2 1 0 Reset Valuesfr S2CON = 0x9A; //S2 Control S2SM0 S2SM1 S2SM2 S2REN S2TB8 S2RB8 S2TI S2RI 00000000Bsfr S2BUF = 0x9B; //S2 Serial Buffer xxxx,xxxxsfr BRT = 0x9C; //S2 Baud-Rate Timer 0000,0000//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机看门狗定时器特殊功能寄存器sfr WDT_CONTR = 0xC1; //Watch-Dog-Timer Control register// 7 6 5 4 3 2 1 0 Reset Value// WDT_FLAG - EN_WDT CLR_WDT IDLE_WDT PS2 PS1 PS0 xx00,0000//-----------------------//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机PCA/PWM 特殊功能寄存器// 7 6 5 4 3 2 1 0 Reset Valuesfr CCON = 0xD8; //PCA 控制寄存器。 CF CR - - - - CCF1 CCF0 00xx,xx00//-----------------------sbit CF = CCON^7; //PCA计数器溢出标志,由硬件或软件置位,必须由软件清0。sbit CR = CCON^6; //1:允许 PCA 计数器计数, 必须由软件清0。//-//-sbit CCF1 = CCON^1; //PCA 模块1 中断标志, 由硬件置位, 必须由软件清0。sbit CCF0 = CCON^0; //PCA 模块0 中断标志, 由硬件置位, 必须由软件清0。//-----------------------sfr CMOD = 0xD9; //PCA 工作模式寄存器。 CIDL - - - CPS2 CPS1 CPS0 ECF 0xxx,x000/*CIDL: idle 状态时 PCA 计数器是否继续计数, 0: 继续计数, 1: 停止计数。CPS2: PCA 计数器脉冲源选择位 2。CPS1: PCA 计数器脉冲源选择位 1。CPS0: PCA 计数器脉冲源选择位 0。 CPS2 CPS1 CPS0 0 0 0 系统时钟频率 fosc/12。 0 0 1 系统时钟频率 fosc/2。 0 1 0 Timer0 溢出。 0 1 1 由 ECI/P3.4 脚输入的外部时钟,最大 fosc/2。 1 0 0 系统时钟频率, Fosc/1 1 0 1 系统时钟频率/4,Fosc/4 1 1 0 系统时钟频率/6,Fosc/6 1 1 1 系统时钟频率/8,Fosc/8ECF: PCA计数器溢出中断允许位, 1--允许 CF(CCON.7) 产生中断。*///-----------------------sfr CL = 0xE9; //PCA 计数器低位 0000,0000sfr CH = 0xF9; //PCA 计数器高位 0000,0000//-----------------------// 7 6 5 4 3 2 1 0 Reset Valuesfr CCAPM0 = 0xDA; //PCA 模块0 PWM 寄存器 - ECOM0 CAPP0 CAPN0 MAT0 TOG0 PWM0 ECCF0 x000,0000sfr CCAPM1 = 0xDB; //PCA 模块1 PWM 寄存器 - ECOM1 CAPP1 CAPN1 MAT1 TOG1 PWM1 ECCF1 x000,0000//ECOMn = 1:允许比较功能。//CAPPn = 1:允许上升沿触发捕捉功能。//CAPNn = 1:允许下降沿触发捕捉功能。//MATn = 1:当匹配情况发生时, 允许 CCON 中的 CCFn 置位。//TOGn = 1:当匹配情况发生时, CEXn 将翻转。//PWMn = 1:将 CEXn 设置为 PWM 输出。//ECCFn = 1:允许 CCON 中的 CCFn 触发中断。//ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn// 0 0 0 0 0 0 0 0x00 未启用任何功能。// x 1 0 0 0 0 x 0x21 16位CEXn上升沿触发捕捉功能。// x 0 1 0 0 0 x 0x11 16位CEXn下降沿触发捕捉功能。// x 1 1 0 0 0 x 0x31 16位CEXn边沿(上、下沿)触发捕捉功能。// 1 0 0 1 0 0 x 0x49 16位软件定时器。// 1 0 0 1 1 0 x 0x4d 16位高速脉冲输出。// 1 0 0 0 0 1 0 0x42 8位 PWM。//ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn// 0 0 0 0 0 0 0 0x00 无此操作// 1 0 0 0 0 1 0 0x42 普通8位PWM, 无中断// 1 1 0 0 0 1 1 0x63 PWM输出由低变高可产生中断// 1 0 1 0 0 1 1 0x53 PWM输出由高变低可产生中断// 1 1 1 0 0 1 1 0x73 PWM输出由低变高或由高变低都可产生中断//-----------------------sfr CCAP0L = 0xEA; //PCA 模块 0 的捕捉/比较寄存器低 8 位。 0000,0000sfr CCAP0H = 0xFA; //PCA 模块 0 的捕捉/比较寄存器高 8 位。 0000,0000sfr CCAP1L = 0xEB; //PCA 模块 1 的捕捉/比较寄存器低 8 位。 0000,0000sfr CCAP1H = 0xFB; //PCA 模块 1 的捕捉/比较寄存器高 8 位。 0000,0000//-----------------------// 7 6 5 4 3 2 1 0 Reset Valuesfr PCA_PWM0 = 0xF2; //PCA 模块0 PWM 寄存器。 - - - - - - EPC0H EPC0L xxxx,xx00sfr PCA_PWM1 = 0xF3; //PCA 模块1 PWM 寄存器。 - - - - - - EPC1H EPC1L xxxx,xx00//PCA_PWMn: 7 6 5 4 3 2 1 0// - - - - - - EPCnH EPCnL//B7-B2: 保留//B1(EPCnH): 在 PWM 模式下,与 CCAPnH 组成 9 位数。//B0(EPCnL): 在 PWM 模式下,与 CCAPnL 组成 9 位数。//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机 ADC 特殊功能寄存器// 7 6 5 4 3 2 1 0 Reset Valuesfr ADC_CONTR = 0xBC; //A/D 转换控制寄存器 ADC_POWER SPEED1 SPEED0 ADC_FLAG ADC_START CHS2 CHS1 CHS0 0000,0000sfr ADC_RES = 0xBD; //A/D 转换结果高8位 ADCV.9 ADCV.8 ADCV.7 ADCV.6 ADCV.5 ADCV.4 ADCV.3 ADCV.2 0000,0000sfr ADC_RESL = 0xBE; //A/D 转换结果低2位 ADCV.1 ADCV.0 0000,0000//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机 SPI 特殊功能寄存器// 7 6 5 4 3 2 1 0 Reset Valuesfr SPCTL = 0xCE; //SPI Control Register SSIG SPEN DORD MSTR CPOL CPHA SPR1 SPR0 0000,0100sfr SPSTAT = 0xCD; //SPI Status Register SPIF WCOL - - - - - - 00xx,xxxxsfr SPDAT = 0xCF; //SPI Data Register 0000,0000//--------------------------------------------------------------------------------//新一代 1T 8051系列 单片机 IAP/ISP 特殊功能寄存器sfr IAP_DATA = 0xC2;sfr IAP_ADDRH = 0xC3;sfr IAP_ADDRL = 0xC4;// 7 6 5 4 3 2 1 0 Reset Valuesfr IAP_CMD = 0xC5; //IAP Mode Table 0 - - - - - MS1 MS0 0xxx,xx00sfr IAP_TRIG = 0xC6;sfr IAP_CONTR = 0xC7; //IAP Control Register IAPEN SWBS SWRST CFAIL - WT2 WT1 WT0 0000,x000//--------------------------------------------------------------------------------/#endif
STC12C2052AD.H
#ifndef __STC12C2052AD_H_#define __STC12C2052AD_H_//* The following is STC additional SFR or change *//* sfr AUXR = 0x8e; *//* sfr IPH = 0xb7; *//* Watchdog Timer Register */sfr WDT_CONTR = 0xe1; /* ISP_IAP_EEPROM Register */sfr ISP_DATA = 0xe2;sfr ISP_ADDRH = 0xe3;sfr ISP_ADDRL = 0xe4;sfr ISP_CMD = 0xe5;sfr ISP_TRIG = 0xe6;sfr ISP_CONTR = 0xe7;/* IDLE, Clock Divider */sfr IDLE_CLK = 0xc7;sfr WAKE_CLKO = 0x8F;/* I_O Port Mode Set Register */sfr P0M0 = 0x93;sfr P0M1 = 0x94;sfr P1M0 = 0x91;sfr P1M1 = 0x92;sfr P2M0 = 0x95;sfr P2M1 = 0x96;sfr P3M0 = 0xb1;sfr P3M1 = 0xb2;/* SPI Register */sfr SPSTAT = 0x84;sfr SPCTL = 0x85;sfr SPDAT = 0x86;/* ADC Register */sfr ADC_CONTR = 0xc5;sfr ADC_DATA = 0xc6;sfr ADC_LOW2 = 0xbe;/* PCA SFR */sfr CCON = 0xD8;sfr CMOD = 0xD9;sfr CCAPM0 = 0xDA;sfr CCAPM1 = 0xDB;sfr CCAPM2 = 0xDC;sfr CCAPM3 = 0xDD;sfr CCAPM4 = 0xDE;sfr CCAPM5 = 0xDF;sfr CL = 0xE9;sfr CCAP0L = 0xEA;sfr CCAP1L = 0xEB;sfr CCAP2L = 0xEC;sfr CCAP3L = 0xED;sfr CCAP4L = 0xEE;sfr CCAP5L = 0xEF;sfr CH = 0xF9;sfr CCAP0H = 0xFA;sfr CCAP1H = 0xFB;sfr CCAP2H = 0xFC;sfr CCAP3H = 0xFD;sfr CCAP4H = 0xFE;sfr CCAP5H = 0xFF;sfr PCA_PWM0 = 0xF2;sfr PCA_PWM1 = 0xF3;sfr PCA_PWM2 = 0xF4;sfr PCA_PWM3 = 0xF5;sfr PCA_PWM4 = 0xF6;sfr PCA_PWM5 = 0xF7;/* CCON */sbit CF = CCON^7;sbit CR = CCON^6;sbit CCF5 = CCON^5;sbit CCF4 = CCON^4;sbit CCF3 = CCON^3;sbit CCF2 = CCON^2;sbit CCF1 = CCON^1;sbit CCF0 = CCON^0;/* Above is STC additional SFR or change *//*--------------------------------------------------------------------------REG51F.HHeader file for 8xC31/51, 80C51Fx, 80C51Rx+Copyright (c) 1988-1999 Keil Elektronik GmbH and Keil Software, Inc.All rights reserved.Modification according to DataSheet from April 1999 - SFR's AUXR and AUXR1 added for 80C51Rx+ derivatives--------------------------------------------------------------------------*//* BYTE Registers */sfr P0 = 0x80;sbit P00 = P0^0;sbit P01 = P0^1;sbit P02 = P0^2;sbit P03 = P0^3;sbit P04 = P0^4;sbit P05 = P0^5;sbit P06 = P0^6;sbit P07 = P0^7;sfr P1 = 0x90;sbit P10 = P1^0;sbit P11 = P1^1;sbit P12 = P1^2;sbit P13 = P1^3;sbit P14 = P1^4;sbit P15 = P1^5;sbit P16 = P1^6;sbit P17 = P1^7;sfr P2 = 0xA0;sbit P20 = P2^0;sbit P21 = P2^1;sbit P22 = P2^2;sbit P23 = P2^3;sbit P24 = P2^4;sbit P25 = P2^5;sbit P26 = P2^6;sbit P27 = P2^7;sfr P3 = 0xB0;sbit P30 = P3^0;sbit P31 = P3^1;sbit P32 = P3^2;sbit P33 = P3^3;sbit P34 = P3^4;sbit P35 = P3^5;sbit P36 = P3^6;sbit P37 = P3^7;sfr PSW = 0xD0;sfr ACC = 0xE0;sfr B = 0xF0;sfr SP = 0x81;sfr DPL = 0x82;sfr DPH = 0x83;sfr PCON = 0x87;sfr TCON = 0x88;sfr TMOD = 0x89;sfr TL0 = 0x8A;sfr TL1 = 0x8B;sfr TH0 = 0x8C;sfr TH1 = 0x8D;sfr IE = 0xA8;sfr IP = 0xB8;sfr SCON = 0x98;sfr SBUF = 0x99;/* 80C51Fx/Rx Extensions */sfr AUXR = 0x8E;/* sfr AUXR1 = 0xA2; */sfr SADDR = 0xA9;sfr IPH = 0xB7;sfr SADEN = 0xB9;sfr T2CON = 0xC8;sfr T2MOD = 0xC9;sfr RCAP2L = 0xCA;sfr RCAP2H = 0xCB;sfr TL2 = 0xCC;sfr TH2 = 0xCD;/* BIT Registers *//* PSW */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;/* TCON */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;/* P3 */sbit RD = P3^7;sbit WR = P3^6;sbit T1 = P3^5;sbit T0 = P3^4;sbit INT1 = P3^3;sbit INT0 = P3^2;sbit TXD = P3^1;sbit RXD = P3^0;/* SCON */sbit SM0 = SCON^7; // alternatively "FE"sbit FE = 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; sbit T2EX = P1^1;sbit T2 = P1^0;/* T2CON */sbit TF2 = T2CON^7;sbit EXF2 = T2CON^6;sbit RCLK = T2CON^5;sbit TCLK = T2CON^4;sbit EXEN2 = T2CON^3;sbit TR2 = T2CON^2;sbit C_T2 = T2CON^1;sbit CP_RL2= T2CON^0;/* PCA Pin */sbit CEX3 = P2^4;sbit CEX2 = P2^0;sbit CEX1 = P3^5;sbit CEX0 = P3^7;sbit ECI = P3^4;/* IE */sbit EA = IE^7;sbit EPCA_LVD = IE^6;sbit EADC_SPI = IE^5;sbit ES = IE^4;sbit ET1 = IE^3;sbit EX1 = IE^2;sbit ET0 = IE^1;sbit EX0 = IE^0;/* IP */ sbit PPCA_LVD = IP^6;sbit PADC_SPI = IP^5; sbit PS = IP^4;sbit PT1 = IP^3;sbit PX1 = IP^2;sbit PT0 = IP^1;sbit PX0 = IP^0;/#endif
REG51.H
/*--------------------------------------------------------------------------REG51.HHeader file for generic 80C51 and 80C31 microcontroller.Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.All rights reserved.--------------------------------------------------------------------------*/#ifndef __REG51_H__#define __REG51_H__/* BYTE Register */sfr P0 = 0x80;sfr P1 = 0x90;sfr P2 = 0xA0;sfr P3 = 0xB0;sfr PSW = 0xD0;sfr ACC = 0xE0;sfr B = 0xF0;sfr SP = 0x81;sfr DPL = 0x82;sfr DPH = 0x83;sfr PCON = 0x87;sfr TCON = 0x88;sfr TMOD = 0x89;sfr TL0 = 0x8A;sfr TL1 = 0x8B;sfr TH0 = 0x8C;sfr TH1 = 0x8D;sfr IE = 0xA8;sfr IP = 0xB8;sfr SCON = 0x98;sfr SBUF = 0x99;/* BIT Register *//* PSW */sbit CY = 0xD7;sbit AC = 0xD6;sbit F0 = 0xD5;sbit RS1 = 0xD4;sbit RS0 = 0xD3;sbit OV = 0xD2;sbit P = 0xD0;/* TCON */sbit TF1 = 0x8F;sbit TR1 = 0x8E;sbit TF0 = 0x8D;sbit TR0 = 0x8C;sbit IE1 = 0x8B;sbit IT1 = 0x8A;sbit IE0 = 0x89;sbit IT0 = 0x88;/* IE */sbit EA = 0xAF;sbit ES = 0xAC;sbit ET1 = 0xAB;sbit EX1 = 0xAA;sbit ET0 = 0xA9;sbit EX0 = 0xA8;/* IP */ sbit PS = 0xBC;sbit PT1 = 0xBB;sbit PX1 = 0xBA;sbit PT0 = 0xB9;sbit PX0 = 0xB8;/* P3 */sbit RD = 0xB7;sbit WR = 0xB6;sbit T1 = 0xB5;sbit T0 = 0xB4;sbit INT1 = 0xB3;sbit INT0 = 0xB2;sbit TXD = 0xB1;sbit RXD = 0xB0;/* SCON */sbit SM0 = 0x9F;sbit SM1 = 0x9E;sbit SM2 = 0x9D;sbit REN = 0x9C;sbit TB8 = 0x9B;sbit RB8 = 0x9A;sbit TI = 0x99;sbit RI = 0x98;#endif
REG52.H
/*--------------------------------------------------------------------------REG52.HHeader file for generic 80C52 and 80C32 microcontroller.Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.All rights reserved.--------------------------------------------------------------------------*/#ifndef __REG52_H__#define __REG52_H__/* BYTE Registers */sfr P0 = 0x80;sfr P1 = 0x90;sfr P2 = 0xA0;sfr P3 = 0xB0;sfr PSW = 0xD0;sfr ACC = 0xE0;sfr B = 0xF0;sfr SP = 0x81;sfr DPL = 0x82;sfr DPH = 0x83;sfr PCON = 0x87;sfr TCON = 0x88;sfr TMOD = 0x89;sfr TL0 = 0x8A;sfr TL1 = 0x8B;sfr TH0 = 0x8C;sfr TH1 = 0x8D;sfr IE = 0xA8;sfr IP = 0xB8;sfr SCON = 0x98;sfr SBUF = 0x99;/* 8052 Extensions */sfr T2CON = 0xC8;sfr T2MOD = 0xC9; //ADDsfr RCAP2L = 0xCA;sfr RCAP2H = 0xCB;sfr TL2 = 0xCC;sfr TH2 = 0xCD;/* BIT Registers *//* PSW */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; //8052 only/* TCON */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;/* IE */sbit EA = IE^7;sbit ET2 = IE^5; //8052 onlysbit ES = IE^4;sbit ET1 = IE^3;sbit EX1 = IE^2;sbit ET0 = IE^1;sbit EX0 = IE^0;/* IP */sbit PT2 = IP^5;sbit PS = IP^4;sbit PT1 = IP^3;sbit PX1 = IP^2;sbit PT0 = IP^1;sbit PX0 = IP^0;/* P3 */sbit RD = P3^7;sbit WR = P3^6;sbit T1 = P3^5;sbit T0 = P3^4;sbit INT1 = P3^3;sbit INT0 = P3^2;sbit TXD = P3^1;sbit RXD = P3^0;/* SCON */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;/* P1 */sbit T2EX = P1^1; // 8052 onlysbit T2 = P1^0; // 8052 only /* T2CON */sbit TF2 = T2CON^7;sbit EXF2 = T2CON^6;sbit RCLK = T2CON^5;sbit TCLK = T2CON^4;sbit EXEN2 = T2CON^3;sbit TR2 = T2CON^2;sbit C_T2 = T2CON^1;sbit CP_RL2 = T2CON^0;#endif