程序如下:
void __irq EINT1_Hand (void)
{
EXTINT = EINT1; /* clear interrupt */
//IENABLE; /* handles nested interrupt */
IOSET1 = 0x20000000;
delay(500);
//EXTINT = EINT1; /* clear interrupt */
//IDISABLE;
//while((EXTINT&0x02)!=0)
//{
// EXTINT=0x02;//清除中断标志
//}
VICVectAddr = 0x00; /* Acknowledge Interrupt */
}
int main (void)
{
// DWORD *vect_addr;
// DWORD *vect_cntl;
// PINSEL4 = 0x00400000; /* set P2.10 as EINT0 and*/
PINSEL4 = 0x00400000;
IODIR1 = 0xFFFFFFFF;
/* initialize GPIO pins as external interrupts */
UARTInit(0,9600);
//EINT1_Init();
EXTMODE=0x02;//设置EINT1为边沿触发模式
EXTPOLAR=0x00;//设置EINT1为下降沿触发
SendByte(0,0x05);
//VICIntEnClr = 1 << 15;
VICIntSelect=0;//设置所有中断为IRQ中断
VICVectAddr15=(int)EINT1_Hand;//设置中断服务程序地址
//VICVectCntl15=0x01;
//EXTINT=0x02;//清除EINT1中断标志
//VICIntEnClr = 1 << 15;
//EXTINT = EINT1;
VICIntEnable=1<<15;//使能EINT1中断
SendByte(0,0x06);
/****** It's an endless loop waiting for external interrupt ******/
/* On Keil MCB2300 board, EINT0 can be used to test the external interrupt */
while( 1 )
{
IOSET1 = 0x20000000;
delay(1);
IOCLR1 = 0x20000000;
delay(500);
//delay(1000);
//VICVectAddr = 0; /* Acknowledge Interrupt */
}
//return 0;
}
在执行到VICIntEnable=1<<15;//使能EINT1中断
的时候就进入了中断 然后就一直在中断里面死循环了 有谁知道怎么回事啊 ? |