#include "REG8051.h"
#define uchar unsigned char
#define uint unsigned int
sbit a0=P0^0; /* course signal */
sbit a1=P0^1;
sbit alarmplus = P2^4;
sbit LED1=P0^5;
sbit LED2=P0^6;
sbit LED3=P0^7;
bit overflag = 0;
bit FINT0;
bit FINT1;
bit FT0;
bit FT1;
bit FT2;
//bit dd;
//bit dd2;
void main()
{
PCR0=0xFF;
PUCR0=0xFF;
P0=0xFF;
PCR2=0x00;
PUCR2=0xFF;
P2=0x00;
LED1 = 0;
PUCR2=0x00;
P2=0x00;
PCON|=0x02; /* 使能外部时钟 */
EA=1;
EX0 =1;
IT0=0; // INT0低电平触发(为1则为下降沿触发)
EX1 = 1;
IT1 = 1;
IEIP = 0x07;
EXADF = 0x15;
while(1)
{
}
}
//INT0中断 由P3.2引脚产生
void int_0() interrupt 0 using 0
{
FINT0=1;
LED1= ~LED1;
}
//-------------------------------------------------------------------
//INT1中断 由P3.3引脚产生
void int_1() interrupt 2 using 1
{
FINT1=1;
LED1= ~LED1;
}
//-------------------------------------------------------------------
//定时器0中断
void timer_0() interrupt 1 using 2
{
FT0=1;
LED1= ~LED1;
}
//-------------------------------------------------------------------
//定时器1中断
void timer_1() interrupt 3 using 3
{
FT1=1;
LED1= ~LED1;
}
//-------------------------------------------------------------------
//串行中断1
void serial_1() interrupt 4
{
}
//-------------------------------------------------------------------
//定时器2中断
void timer_2() interrupt 5
{
FT2=1;
LED1= ~LED1;
}
//-------------------------------------------------------------------
//void int0_int() interrupt 0 using 1
//{
// TR1 = 1;
//}
//void int1_int() interrupt 1 using 1
//{
// TR1 = 1;
//}
void int4_int() interrupt 9 using 1
{
LED1= ~LED1;
}