/*------------------------------------------------*/
/* --- 宏晶科技 STCMCU ---------------------------*/
/* --- Mobile: (86)13922805190 -------------------*/
/* --- Fax: 86-755-82944243 ----------------------*/
/* --- Tel: 86-755-82948412 ----------------------*/
/* --- Web: www.STCMCU.com -----------------------*/
/* 适用于: STC12C5AxxX STC12LE5AxxX ------------*/
/* ------- STC12C5AxxCPP STC12LE5AxxCPP ----------*/
/* ------- STC12C5AxxAD STC12LE5AxxAD ----------*/
/* ------- STC12C5AxxS2 STC12LE5AxxS2 ----------*/
/* ------- IAP12C5Axx IAP12LE5Axx ----------*/
/* ------- IAP12C5AxxCPP IAP12LE5AxxCPP ----------*/
/* ------- IAP12C5AxxAD IAP12LE5AxxAD ----------*/
/* ------- IAP12C5AxxS2 IAP12LE5AxxS2 ----------*/
/*------------------------------------------------*/
#ifndef __STC12C5A_H__
#define __STC12C5A_H__
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sfr PSW = 0xd0; //程序状态字 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//位描述 CY AC F0 RS1 RS0 OV F1 P
//初始值=0000,0000 0 0 0 0 0 0 0 0
sbit CY = PSW^7; //进位标志
sbit AC = PSW^6; //辅助进位标志
sbit F0 = PSW^5; //用户标志
sbit RS1 = PSW^4; //寄存器组选择位1
sbit RS0 = PSW^3; //寄存器组选择位0
sbit OV = PSW^2; //溢出标志
sbit P = PSW^0; //ACC的偶校验位
/////////////////////////////////
sfr ACC = 0xe0; //累加器 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//初始值=0000,0000 0 0 0 0 0 0 0 0
sbit ACC7 = ACC^7; //累加器第7位
sbit ACC6 = ACC^6; //累加器第6位
sbit ACC5 = ACC^5; //累加器第5位
sbit ACC4 = ACC^4; //累加器第4位
sbit ACC3 = ACC^3; //累加器第3位
sbit ACC2 = ACC^2; //累加器第2位
sbit ACC1 = ACC^1; //累加器第1位
sbit ACC0 = ACC^0; //累加器第0位
/////////////////////////////////
sfr B = 0xf0; //B寄存器 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//初始值=0000,0000 0 0 0 0 0 0 0 0
/////////////////////////////////
sfr SP = 0x81; //堆栈指针 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//初始值=0000,0111 0 0 0 0 0 1 1 1
/////////////////////////////////
sfr DPL = 0x82; //数据指针低字节 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//初始值=0000,0000 0 0 0 0 0 0 0 0
/////////////////////////////////
sfr DPH = 0x83; //数据指针高字节 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//初始值=0000,0000 0 0 0 0 0 0 0 0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sfr PCON = 0x87; //电源控制寄存器 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//位描述 SMOD SMOD0 LVDF POF GF1 GF0 PD IDL
//初始值=0011,0000 0 0 1 1 0 0 0 0
#define SMOD 0x80 //串口波特率倍速位,置1可使波特率快1倍
#define SMOD0 0x40 //FE/SM0选择位,0:SCON.7为SM0 1:SCON.7为FE
#define LVDF 0x20 //低压检测中断请求位,由硬件置1,需由软件清0
#define POF 0x10 //上电复位标志位,上电时由硬件置1,需由软件清0
#define GF1 0x08 //通用标志位1
#define GF0 0x04 //通用标志位0
#define PD 0x02 //掉电控制位,写1可以使MCU进入PowerDown模式
#define IDL 0x01 //空闲控制位,写1可以使MCU进入Idle模式
/////////////////////////////////
sfr WAKE_CLKO = 0x8f; //掉电唤醒/时钟输出控制 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//位描述 PCAWAKEUP RXDPINIE T1PINIE T0PINIE LVD_WAKEUP BRTCLKO T1VLKO T0CLKO
//初始值=0000,0000 0 0 0 0 0 0 0 0
#define PCAWAKEUP 0x80 //允许PCA的上升沿/下降沿中断唤醒掉电MCU
#define RXD_PIN_IE 0x40 //允许RXD(P3.0)下降沿置位RI中断时唤醒掉电MCU(必须打开相应中断)
#define T1_PIN_IE 0x20 //允许T1(P3.5)下降沿置位T1中断时唤醒掉电MCU(必须打开相应中断)
#define T0_PIN_IE 0x10 //允许T0(P3.4)下降沿置位T0中断时唤醒掉电MCU(必须打开相应中断)
#define LVD_WAKEUP 0x08 //允许LVD(P4.6)的低压检测中断唤醒掉电MCU(必须打开相应中断)
#define BRTCLKOEN 0x04 //打开P1.0脚的BRT时钟溢出脉冲,输出的时钟频率为1/2倍的BRT溢出率
#define T1CLKOEN 0x02 //打开P3.5脚的定时器1时钟溢出脉冲,输出的时钟频率为1/2倍的T1溢出率
#define T0CLKOEN 0x01 //打开P3.4脚的定时器0时钟溢出脉冲,输出的时钟频率为1/2倍的T0溢出率
/////////////////////////////////
sfr CLK_DIV = 0x97; //时钟分频寄存器 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//位描述 - - - - - CLKS2 CLKS1 CLKS0
//初始值=xxxx,x000 x x x x x 0 0 0
#define FOSCD1 0x00 //系统时钟为Fosc
#define FOSCD2 0x01 //系统时钟为Fosc/2
#define FOSCD4 0x02 //系统时钟为Fosc/4
#define FOSCD8 0x03 //系统时钟为Fosc/8
#define FOSCD16 0x04 //系统时钟为Fosc/16
#define FOSCD32 0x05 //系统时钟为Fosc/32
#define FOSCD64 0x06 //系统时钟为Fosc/64
#define FOSCD128 0x07 //系统时钟为Fosc/128
/////////////////////////////////
sfr BUS_SPEED = 0xa1; //数据总线速度控制器 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//位描述 - - ALES1 ALES0 - RWS2 RWS1 RWS0
//初始值=xx10,x011 x x 1 0 x 0 1 1
#define ALES1 0x20 //P0地址建立时间和保持时间到ALE信号的下降沿的时钟数
#define ALES0 0x10 //ALES1/ALES0=0/0:1个时钟 0/1:2个时钟 1/0:3个时钟 1/1:4个时钟
#define RWS2 0x04 //MOVX指令的时钟数
#define RWS1 0x02 //RWS2/RWS1/RWS0=000:1个时钟 001:2个时钟 010:3个时钟 011:4个时钟
#define RWS0 0x01 // 100:5个时钟 101:6个时钟 110:7个时钟 111:8个时钟
/////////////////////////////////
sfr WDT_CONTR = 0xc1; //看门狗定时器控制器 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
//位描述 WDT_FLAG - EN_WDT CLR_WDT IDL_WDT PS2 PS1 PS0
//初始值=0x00,0000 0 x 0 0 0 0 0 0
#define WDT_FLAG 0x80 //看门狗复位标志,当看门狗溢出产生复位后,硬件自动置1,需要由软件清0
#define EN_WDT 0x20 //软件使能看门狗,打开后不能用软件的方式关闭
#define CLR_WDT 0x10 //清看门狗定时器
#define IDLE_WDT 0x08 //IDLE模式下,看门狗定时器是否继续计时
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sfr AUXR
STC头文件大全STC12C54头文件
5星 · 超过95%的资源 需积分: 9 150 浏览量
2011-08-18
22:14:38
上传
评论
收藏 46KB RAR 举报
single992
- 粉丝: 0
- 资源: 22
最新资源
- 实验二:IP协议分析.zip
- 驱动代码驱动代码驱动代码驱动代码
- SVID_20240523_141155_1.mp4
- Code for the complete guide to tkinter tutorial
- 关于百货中心供应链管理系统.zip
- SimpleFolderIcon-master 修改Unity的Project下的文件夹图标
- A python Tkinter widget to display tile based maps
- A pure Python library for adding tables to a Tkinter application
- Vector资源文件.zip
- MobaXterm-Installer
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页