📄 interrupt.h
字号:
/************************************************************************************
* Copyright (c), 2004-2007,西安铭朗电子科技有限责任公司
* All rights reserved.
*
* Http: www.mlarm.com
* Email: mlarm@mlarm.com
*
* File name: interrupt.h
* Project : ML-F020ICB
* Processor: C8051F020
* Compiler : Keil C51 Compiler
*
* Author: 李林利
* Version: 1.20
* Date: 2007.6.1
* Email: GavinLi@126.com
*
* Description: 本文件是设置硬件中断驱动程序头文件;
*
* Others: none;
*
* Function List:
* 1. void Interrupt_Init(void)
* 2. void Interrupt_Enable(unsigned char index)
* 3. void Interrupt_Disable(unsigned char index)
* 4. void Priority_Enable(unsigned char index)
* 5. void Priority_Disable(unsigned char index)
*
* History:
* 1. Author: 李林利
* Version: 1.10
* Date: 2007.3.12
* Modification: none
*
* 2. Author: 李林利
* Version: 1.00
* Date: 2004.11.24
* Modification: 建立文件
*
*************************************************************************************/
/*************************************************************************************
* 中断设置函数使用说明
*
* 1. 第1步,在系统初始化函数中必须先调用函数Interrupt_Init(), 关闭所有中断,
* 本函数只允许调用1次;
* 2. 第2步,调用Interrupt_Enable()和Interrupt_Disable()两个函数对CPU所有中断进行设置;
* 调用Priority_Enable()和Priority_Disable()两个函数对CPU所有中断优先级进行设置;
* 3. 其它细节详见具体函数说明;
*
*************************************************************************************/
/*************************************************************************************
* 常量及全局变量定义
*************************************************************************************/
// 以下定义绝对不能修改
// 中断源编号索引定义
#define INT0_INT 0 // 外部中断0 (/INT0)
#define TIMER0_INT 1 // 定时器0 溢出
#define INT1_INT 2 // 外部中断1 (/INT1)
#define TIMER1_INT 3 // 定时器1 溢出
#define UART0_INT 4 // UART0 接收或发送中断
#define TIMER2_INT 5 // 定时器2 溢出(或EXF2)
#define SPI_INT 6 // SPI外设接口
#define IIC_INT 7 // SMBus接口
#define AD0W_INT 8 // ADC0 窗口比较
#define PCA_INT 9 // 可编程计数器阵列
#define CP0F_INT 10 // 比较器0 下降沿
#define CP0R_INT 11 // 比较器0 上升沿
#define CP1F_INT 12 // 比较器1 下降沿
#define CP1R_INT 13 // 比较器1 上升沿
#define TIMER3_INT 14 // 定时器3 溢出
#define AD0_INT 15 // ADC0 转换结束
#define TIMER4_INT 16 // 定时器4 溢出
#define AD1_INT 17 // ADC1 转换结束
#define INT6_INT 18 // 外部中断6
#define INT7_INT 19 // 外部中断7
#define UART1_INT 20 // UART1 接收或发送中断
#define XTLVLD_INT 21 // 外部晶体振荡器准备好
/*************************************************************************************/
//
// 中断设置函数外部引用声明
//
/*************************************************************************************/
/***********************************************************************************
* Function: Interrupt_Init;
*
* Description: 中断初始化函数;
*
* Input: none;
*
* Output: none;
*
* Return: none;
*
* Note: 调用此函数将清除所有中断和优先级;
************************************************************************************/
void Interrupt_Init(void);
/***********************************************************************************
* Function: Interrupt_Enable;
*
* Description: 允许中断函数;
*
* Input: index, 中断源编号索引;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void Interrupt_Enable(unsigned char index);
/***********************************************************************************
* Function: Interrupt_Disable;
*
* Description: 关闭中断函数;
*
* Input: index, 中断源编号索引;
*
* Output: none;
*
* Return: none;
*
* Note: 此函数未对总中断(EA)进行允许操作;
************************************************************************************/
void Interrupt_Disable(unsigned char index);
/***********************************************************************************
* Function: Priority_Enable;
*
* Description: 设置中断高优先级函数;
*
* Input: index, 中断源编号索引;
*
* Output: none;
*
* Return: none;
*
* Note: 此函数未对总中断(EA)进行关闭操作;
************************************************************************************/
void Priority_Enable(unsigned char index);
/***********************************************************************************
* Function: Priority_Disable;
*
* Description: 取消中断高优先级函数;
*
* Input: index, 中断源编号索引;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void Priority_Disable(unsigned char index);
/***********************************************************************************/
// 文件结束
/***********************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -