#ifndef __STC15F2K60S2_H_ #define __STC15F2K60S2_H_
/////////////////////////////////////////////////
//注意: STC15W4K32S4系列的芯片,上电后所有与PWM相关的IO口均为 // 高阻态,需将这些口设置为准双向口或强推挽模式方可正常使用 //相关IO: P0.6/P0.7/P1.6/P1.7/P2.1/P2.2 // P2.3/P2.7/P3.7/P4.2/P4.4/P4.5 /////////////////////////////////////////////////
/////////////////////////////////////////////////
//包含本头文件后,不用另外再包含\
//内核特殊功能寄存器 // 复位值 描述
sfr ACC = 0xE0; //0000,0000 累加器Accumulator sfr B = 0xF0; //0000,0000 B寄存器 sfr PSW = 0xD0; //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; //0000,0111 堆栈指针
sfr DPL = 0x82; //0000,0000 数据指针低字节 sfr DPH = 0x83; //0000,0000 数据指针高字节
//I/O 口特殊功能寄存器
sfr P0 = 0x80; //1111,1111 端口0 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; //1111,1111 端口1 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; //1111,1111 端口2 sbit P20 = P2^0; sbit P21 = P2^1; sbit P22 = P2^2; sbit P23 = P2^3; sbit P24 = sbit P25 = sbit P26 = sbit P27 = sfr P3 = sbit P30 = sbit P31 = sbit P32 = sbit P33 = sbit P34 = sbit P35 = sbit P36 = sbit P37 = sfr P4 = sbit P40 = sbit P41 = sbit P42 = sbit P43 = sbit P44 = sbit P45 = sbit P46 = sbit P47 = sfr P5 = sbit P50 = sbit P51 = sbit P52 = sbit P53 = sbit P54 = sbit P55 = sbit P56 = sbit P57 = sfr P6 = sbit P60 = sbit P61 = sbit P62 = P2^4; P2^5; P2^6; P2^7;
0xB0; //1111,1111 端口3 P3^0; P3^1; P3^2; P3^3; P3^4; P3^5; P3^6; P3^7;
0xC0; //1111,1111 端口4 P4^0; P4^1; P4^2; P4^3; P4^4; P4^5; P4^6; P4^7;
0xC8; //xxxx,1111 端口5 P5^0; P5^1; P5^2; P5^3; P5^4; P5^5; P5^6; P5^7;
0xE8; //0000,0000 端口6 P6^0; P6^1; P6^2;
sbit P63 = P6^3; sbit P64 = P6^4; sbit P65 = P6^5; sbit P66 = P6^6; sbit P67 = P6^7;
sfr P7 = 0xF8; //0000,0000 端口7 sbit P70 = P7^0; sbit P71 = P7^1; sbit P72 = P7^2; sbit P73 = P7^3; sbit P74 = P7^4; sbit P75 = P7^5; sbit P76 = P7^6; sbit P77 = P7^7;
sfr P0M0 = 0x94; //0000,0000 端口0模式寄存器0 sfr P0M1 = 0x93; //0000,0000 端口0模式寄存器1 sfr P1M0 = 0x92; //0000,0000 端口1模式寄存器0 sfr P1M1 = 0x91; //0000,0000 端口1模式寄存器1 sfr P2M0 = 0x96; //0000,0000 端口2模式寄存器0 sfr P2M1 = 0x95; //0000,0000 端口2模式寄存器1 sfr P3M0 = 0xB2; //0000,0000 端口3模式寄存器0 sfr P3M1 = 0xB1; //0000,0000 端口3模式寄存器1 sfr P4M0 = 0xB4; //0000,0000 端口4模式寄存器0 sfr P4M1 = 0xB3; //0000,0000 端口4模式寄存器1 sfr P5M0 = 0xCA; //0000,0000 端口5模式寄存器0 sfr P5M1 = 0xC9; //0000,0000 端口5模式寄存器1 sfr P6M0 = 0xCC; //0000,0000 端口6模式寄存器0 sfr P6M1 = 0xCB; //0000,0000 端口6模式寄存器1 sfr P7M0 = 0xE2; //0000,0000 端口7模式寄存器0 sfr P7M1 = 0xE1; //0000,0000 端口7模式寄存器1
//系统管理特殊功能寄存器
sfr PCON = 0x87; //0001,0000 电源控制寄存器 sfr AUXR = 0x8E; //0000,0000 辅助寄存器 sfr AUXR1 = 0xA2; //0000,0000 辅助寄存器1
sfr P_SW1 = 0xA2; //0000,0000 外设端口切换寄存器1 sfr CLK_DIV = 0x97; //0000,0000 时钟分频控制寄存器 sfr BUS_SPEED = 0xA1; //xx10,x011 总线速度控制寄存器
sfr P1ASF = 0x9D; //0000,0000 端口1模拟功能配置寄存器 sfr P_SW2 = 0xBA; //0xxx,x000 外设端口切换寄存器
//中断特殊功能寄存器
sfr IE = 0xA8; //0000,0000 中断控制寄存器 sbit EA = IE^7;