⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stc11.h

📁 STC单片机全系列头文件
💻 H
📖 第 1 页 / 共 3 页
字号:
#define GF2         0x08        //通用标志位2
#define DPS         0x01        //DPTR0/DPTR1选择位,0:DPTR0 1:DPTR1

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

sfr  P0         =   0x80;       //I/O端口0              Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //位描述                P0.7    P0.6    P0.5    P0.4    P0.3    P0.2    P0.1    P0.0
                                //初始值=1111,1111      1       1       1       1       1       1       1       1

sbit P07        =   P0^7;       //I/O口P0.7
sbit P06        =   P0^6;       //I/O口P0.6
sbit P05        =   P0^5;       //I/O口P0.5
sbit P04        =   P0^4;       //I/O口P0.4
sbit P03        =   P0^3;       //I/O口P0.3
sbit P02        =   P0^2;       //I/O口P0.2
sbit P01        =   P0^1;       //I/O口P0.1
sbit P00        =   P0^0;       //I/O口P0.0

/////////////////////////////////

sfr  P1         =   0x90;       //I/O端口0              Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //位描述                P1.7    P1.6    P1.5    P1.4    P1.3    P1.2    P1.1    P1.0
                                //初始值=1111,1111      1       1       1       1       1       1       1       1

sbit P17        =   P1^7;       //I/O口P1.7
sbit P16        =   P1^6;       //I/O口P1.6
sbit P15        =   P1^5;       //I/O口P1.5
sbit P14        =   P1^4;       //I/O口P1.4
sbit P13        =   P1^3;       //I/O口P1.3
sbit P12        =   P1^2;       //I/O口P1.2
sbit P11        =   P1^1;       //I/O口P1.1
sbit P10        =   P1^0;       //I/O口P1.0

sbit P1TXD      =   P1^7;       //可选串口数据输出脚
sbit P1RXD      =   P1^6;       //可选串口数据输入脚

sbit BRTCLKO    =   P1^0;       //BRT时钟溢出脉冲输出脚

/////////////////////////////////

sfr  P2         =   0xa0;       //I/O端口2              Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //位描述                P2.7    P2.6    P2.5    P2.4    P2.3    P2.2    P2.1    P2.0
                                //初始值=1111,1111      1       1       1       1       1       1       1       1

sbit P27        =   P2^7;       //I/O口P2.7
sbit P26        =   P2^6;       //I/O口P2.6
sbit P25        =   P2^5;       //I/O口P2.5
sbit P24        =   P2^4;       //I/O口P2.4
sbit P23        =   P2^3;       //I/O口P2.3
sbit P22        =   P2^2;       //I/O口P2.2
sbit P21        =   P2^1;       //I/O口P2.1
sbit P20        =   P2^0;       //I/O口P2.0

/////////////////////////////////

sfr  P3         =   0xb0;       //I/O端口3              Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //位描述                P3.7    P3.6    P3.5    P3.4    P3.3    P3.2    P3.1    P3.0
                                //初始值=1111,1111      1       1       1       1       1       1       1       1

sbit P37        =   P3^7;       //I/O口P3.7
sbit P36        =   P3^6;       //I/O口P3.6
sbit P35        =   P3^5;       //I/O口P3.5
sbit P34        =   P3^4;       //I/O口P3.4
sbit P33        =   P3^3;       //I/O口P3.3
sbit P32        =   P3^2;       //I/O口P3.2
sbit P31        =   P3^1;       //I/O口P3.1
sbit P30        =   P3^0;       //I/O口P3.0

sbit RXD        =   P3^0;       //串口1的数据接收口
sbit TXD        =   P3^1;       //串口1的数据发送口
sbit INT0       =   P3^2;       //外部中断0的信号输入口
sbit INT1       =   P3^3;       //外部中断1的信号输出口
sbit T0         =   P3^4;       //定时器0的外部信号输入口
sbit T1         =   P3^5;       //定时器1的外部信号输入口
sbit WR         =   P3^6;       //外部数据存储器的写信号
sbit RD         =   P3^7;       //外部数据存储器的读信号

sbit T0CLKO     =   P3^4;       //定时器0的时钟溢出脉冲输出脚
sbit T1CLKO     =   P3^5;       //定时器1的时钟溢出脉冲输出脚

/////////////////////////////////

sfr  P4         =   0xc0;       //I/O端口4              Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //位描述                P4.7    P4.6    P4.5    P4.4    P4.3    P4.2    P4.1    P4.0
                                //初始值=1111,1111      1       1       1       1       1       1       1       1

sbit P47        =   P4^7;       //I/O口P4.7
sbit P46        =   P4^6;       //I/O口P4.6
sbit P45        =   P4^5;       //I/O口P4.5
sbit P44        =   P4^4;       //I/O口P4.4
sbit P43        =   P4^3;       //I/O口P4.3
sbit P42        =   P4^2;       //I/O口P4.2
sbit P41        =   P4^1;       //I/O口P4.1
sbit P40        =   P4^0;       //I/O口P4.0

/////////////////////////////////

sfr  P1M1       =   0x91;       //I/O口1模式控制器1     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初/始值=0000,0000     0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P1M0       =   0x92;       //I/O口1模式控制器0     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P0M1       =   0x93;       //I/O口0模式控制器1     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P0M0       =   0x94;       //I/O口0模式控制器0     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P2M1       =   0x95;       //I/O口2模式控制器1     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P2M0       =   0x96;       //I/O口2模式控制器0     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P3M1       =   0xb1;       //I/O口3模式控制器1     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初/始值=0000,0000     0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P3M0       =   0xb2;       //I/O口3模式控制器0     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P4M1       =   0xb3;       //I/O口4模式控制器1     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

sfr  P4M0       =   0xb4;       //I/O口4模式控制器0     Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //初始值=0000,0000      0       0       0       0       0       0       0       0

/////////////////////////////////

// PxM1 PxM0
//  0    0     准双向口
//  0    1     强推挽输出
//  1    0     高阻输入态
//  1    1     开漏输出

/////////////////////////////////

sfr  P4SW       =   0xbb;       //P4口的功能开关        Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //位描述                -    LVD_P4.6 ALE_P4.5 NA_P4.4  -       -       -       -
                                //初始值=x000,xxxx      x       0       0       0       x       x       x       x

#define P46EN       0x40        //传统的EA脚 0:无任何功能 1:为P4.6
#define P45EN       0x20        //传统的ALE脚 0:仍为ALE 1:为P4.5
#define P44EN       0x10        //传统的PSEN脚 0:无任何功能 1:为P4.4

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

sfr  IE         =   0xa8;       //中断使能寄存器        Bit7    Bit6    Bit5    Bit4    Bit3    Bit2    Bit1    Bit0
                                //位描述                EA      ELVD    -       ES      ET1     EX1     ET0     EX0
                                //初始值=00x0,0000      0       0       x       0       0       0       0       0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -