STC11F04E头文件

时间:12-03-02 栏目:单片机 作者:JH单片机 评论:0 点击: 10,046 次



关于什么是头文件,怎么用。不用我介绍吧。你懂的。这是一个20脚的单片机,有16个IO口。

//////////////////////////////////////////
//
//STC11F04E头文件
//
//////////////////////////////////////////

#ifndef __STC11F04E_H__
#define __STC11F04E_H__

/*┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
特殊寄存器(SFR)
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈*/
sfr B          = 0xF0;
/////////////////////
sfr ACC        = 0xE0;
/////////////////////
sfr PSW        = 0xD0;
/////////////////////
sfr WDT_CONR   = 0xC1;
sfr IAP_DATA   = 0xC2;
sfr IAP_ADDRH  = 0xC3;
sfr IAP_ADDRL  = 0xC4;
sfr IAP_CMD       = 0xC5;
sfr IAP_TRIG   = 0xC6;
sfr IAP_CONTR  = 0xC7;
/////////////////////
sfr IP         = 0xB8;
/////////////////////
sfr P3         = 0xB0;
sfr P3M0       = 0xB1;
sfr P3M1       = 0xB2;
/////////////////////
sfr IE         = 0xA8;
sfr WKTCL      = 0xAA;
sfr WKTCH      = 0xAB;
/////////////////////
sfr SCON       = 0x98;
sfr SBUF       = 0x99;
sfr BRT        = 0x9C;
/////////////////////
sfr P1         = 0x90;
sfr P1M1       = 0x91;
sfr P1M0       = 0x92;
sfr CLK_DIV       = 0x97;
/////////////////////
sfr TCON       = 0x88;
sfr TMOD       = 0x89;
sfr TL0        = 0x8A;
sfr TL1        = 0x8B;
sfr TH0        = 0x8C;
sfr TH1        = 0x8D;
sfr AUXR       = 0x8E;
sfr WAKE_CLKO  = 0x8F;
/////////////////////
sfr SP         = 0x81;
sfr DPL        = 0x82;
sfr DPH        = 0x83;
sfr PCON       = 0x87;
/////////////////////

/*┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
相关特殊寄存器(SFR)位定义
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈*/
/*  ACC位定义  */
sbit ACC7 = ACC^7;
sbit ACC6 = ACC^6;
sbit ACC5 = ACC^5;
sbit ACC4 = ACC^4;
sbit ACC3 = ACC^3;
sbit ACC2 = ACC^2;
sbit ACC1 = ACC^1;
sbit ACC0 = ACC^0;

/*  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;

/*  IP位定义  */
sbit PT1   = IP^3;
sbit PX1   = IP^2;
sbit PT0   = IP^1;
sbit PX0   = IP^0;

/*  IE位定义  */
sbit EA        = IE^7;
sbit EPCA_LVD  = IE^6;
sbit EADC_SPI  = IE^5;
sbit ES        = IE^3;
sbit ET1       = IE^3;
sbit EX1       = IE^2;
sbit ET0       = IE^1;
sbit EX0       = IE^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;

/*  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;

/* P1端口位定义 */
sbit P17   = P1^7;
sbit P16   = P1^6;
sbit P15   = P1^5;
sbit P14   = P1^4;
sbit P13   = P1^3;
sbit P12   = P1^2;
sbit P11   = P1^1;
sbit P10   = P1^0;

/* P3端口位定义 */
sbit T1    = P3^5;
sbit T0    = P3^4;
sbit INT1  = P3^3;
sbit INT0  = P3^2;
sbit TXD   = P3^1;
sbit RXD   = P3^0;

sbit P37   = P3^7;
sbit P35   = P3^5;
sbit P34   = P3^4;
sbit P33   = P3^3;
sbit P32   = P3^2;
sbit P31   = P3^1;
sbit P30   = P3^0;

#endif

 
关于本文作者

爱数电,爱模电;爱单片机,爱嵌入式;爱EDA,也爱DSP; 爱Altium Designer,也爱PCB;爱生活,同时也爱微博…… 一个自动化专业的学生,与志同道合者学习交流!!!

QQ 号码:594420349
腾讯微博:http://t.qq.com/kevin_753

项目合作