📄 interrupt.c
字号:
/*************************************************************************************
文件类型:
文件作用:
修改权限:
文件相关:
创 建 人:GeminiKQ
创建日期:2006.12.20
当前版本:Ver0.1
版本信息:Ver0.1 GeminiKQ
**************************************************************************************/
#include "Tiger.h"
//=======================================================
//函数名:Interrupt_Int0
//函数作用:端口中断0,中断向量 (03H)
//=======================================================
void Interrupt_Int0 (void) interrupt 0 using 2
{
TCON &= ~BIT1;
// user coding begin
}
//=======================================================
//函数名:Interrupt_Timer0
//函数作用:内核timer0中断,中断向量 (0BH)
//=======================================================
void Interrupt_Timer0 (void) interrupt 1 using 2
{
TCON &= ~BIT5;
TL0 = 0xff; //10ms
TH0 = 0xdf;
//====================读按键状态
flag_keydown.byte=flag_keydown.byte<<1;
flag_keyup.byte=flag_keyup.byte<<1;
key_down_1=Key_dn;
key_up_1=Key_up;
}
//=======================================================
//函数名:Interrupt_Int1
//函数作用:端口中断1,中断向量 (13H)
//=======================================================
void Interrupt_Int1 (void) interrupt 2 using 2
{
TCON &= ~BIT3;
// user coding begin
}
//=======================================================
//函数名:Interrupt_Timer1
//函数作用:内核timer1中断,中断向量 (1BH)
//=======================================================
void Interrupt_Timer1 (void) interrupt 3 using 2
{
TCON &= ~BIT7;
// user coding begin
}
//=======================================================
//函数名:Interrupt_Timer2
//函数作用:内核timer2中断,中断向量 (2BH)
//=======================================================
void Interrupt_Timer2 (void) interrupt 5 using 2
{
T2CON &= ~BIT7;
// user coding begin
}
//=======================================================
//函数名:Interrupt_Uart1
//函数作用:内核uart1中断,中断向量 (3BH)
//=======================================================
void Interrupt_Uart1 (void) interrupt 7 using 2
{
if(SCON1 & BIT0)
{ // 接受中断标记
SCON1 &= ~BIT0;
// user coding begin
rec_485comm(SBUF1);
}
else if(SCON1 & BIT1)
{ // 发送中断标记
SCON1 &= ~BIT1;
// user coding begin
intrupt_send485();
}
}
//=======================================================
//函数名:Interrupt_ExInt2
//函数作用:外部中断2,中断向量 (43H)
//=======================================================
void Interrupt_ExInt2 (void) interrupt 8 using 2
{
if(ExInt2IFG & BIT0)
{// uart2 translate interrupt flag
ExInt2IFG &= ~BIT0;
SCON2 &= ~ExUTI;
SCON2 |= ExUTB8; // bit9
// user coding begin
intrupt_sendinfr();
}
else if(ExInt2IFG & BIT1)
{// uart2 receive interrupt flag
ExInt2IFG &= ~BIT1;
SCON2 &= ~ExURI;
// user coding begin
rec_infrcomm(SBUF2);
}
else if(ExInt2IFG & BIT2)
{// uart4 transfer interrupt flag
ExInt2IFG &= ~BIT2;
SCON4 &= ~ExUTI;
SCON4 |= ExUTB8; // bit9
// user coding begin
}
else if(ExInt2IFG & BIT3)
{// uart4 receive interrupt flag
ExInt2IFG &= ~BIT3;
SCON4 &= ~ExURI;
// user coding begin
}
else if(ExInt2IFG & BIT4)
{// uart2timer0 interrupt
ExInt2IFG &= ~BIT4;
// user coding begin
}
else if(ExInt2IFG & BIT5)
{// uart4timer0 interrupt
ExInt2IFG &= ~BIT5;
// user coding begin
}
else if(ExInt2IFG & BIT6)
{// flash erase interrupt
ExInt2IFG &= ~BIT6;
// user coding begin
}
else if(ExInt2IFG & BIT7)
{// CF impluse interrupt
ExInt2IFG &= ~BIT7;
if(Flg_energ==0)
count_activCF++;
else
count_reactivCF++;
}
EXIF &= ~BIT4;
}
//=======================================================
//函数名:Interrupt_ExInt3
//函数作用:外部中断3,中断向量 (4BH)
//=======================================================
void Interrupt_ExInt3 (void) interrupt 9 using 2
{
if(ExInt3IFG & BIT0)
{
}
else if(ExInt3IFG & BIT1)
{
}
else if(ExInt3IFG & BIT2)
{
}
else if(ExInt3IFG & BIT3)
{
}
else if(ExInt3IFG & BIT4)
{
}
else if(ExInt3IFG & BIT5)
{
}
else if(ExInt3IFG & BIT6) // rtc interrupt
{ ExInt3IFG &= ~BIT6;
// user coding begin
if(sta_keyup==key_dnstation)
{if(time_keyup_on<2)
time_keyup_on++;
}
else if(sta_keyup==key_upstation)
time_keyup_on=0;
if(sta_keydn==key_dnstation)
{if(time_keydn_on<2)
time_keydn_on++;
}
else if(sta_keydn==key_upstation)
time_keydn_on=0;
}
EXIF &= ~BIT5; // clr interrupt flag
}
//=======================================================
//函数名:Interrupt_ExInt4
//函数作用:外部中断4,中断向量 (53H)
//=======================================================
void Interrupt_ExInt4 (void) interrupt 10 using 2
{
if(ExInt4IFG & BIT0)
{
ExInt4IFG &= ~BIT0;
// user coding begin
}
if(ExInt4IFG & BIT1)
{
ExInt4IFG &= ~BIT1;
// user coding begin
}
if(ExInt4IFG & BIT2)
{
ExInt4IFG &= ~BIT2;
// user coding begin
CrtlBGP += 0x02;
CrtlBGP &= ~BIT3;
}
if(ExInt4IFG & BIT3)
{
ExInt4IFG &= ~BIT3;
// user coding begin
}
if(ExInt4IFG & BIT4)
{
ExInt4IFG &= ~BIT4;
// user coding begin
}
EXIF &= ~BIT6;
}
//=======================================================
//函数名:Interrupt_PF
//函数作用:系统掉电预警中断,中断向量 (63H)
//=======================================================
void Interrupt_PF (void) interrupt 12 using 2
{// powerdown interrupt
EICON &= ~BIT3;
// user coding begin
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -