/开发平台为KEIL/
/现象描述:按键按下后P0.14接受低电平,主函数停止,PI口GPIO状态改变,然后就挺住了,求助!/
#include <LPC213X.H>
void delay(int i)
{
int a;
for(a=0;a<70;a++)
for(a=0;a<i;a++);
}
/***********************************************ÖжϷþÎñº¯Êý***************************************************************************/
void IRQ_Eint1(void)
{
IO1SET=0xFFFFFFFF; /*½øÈëÖжϷþÎñº¯Êý*/
delay(70);
EXTINT=0x02;
VICVectAddr=0x00000000; /*ÖжÏÏòÁ¿½áÊø£¬µØÖ·ÇåÁã*/
}
/********************************************************************************************************************************************/
void main (void)
{
PINSEL0=0X20000000; /*Á¬½ÓENIT1 P014*/
IO0DIR=0XFFFFBFFF; /*P014ÉèÖÃΪÊäÈ룬ÆäÓàÉèÖÃΪÊä³ö*/
EXTMODE=0x00; /*µçƽ´¥·¢*/
EXTPOLAR=0X00; /*µÍµçƽ»òÕßϽµÑØ´¥·¢*/
PINSEL1=0x00000000; /*P1¿ÚÁ¬GPI0£¬ÁÁÃðÑéÖ¤ÖжÏÊÇ·ñ³É¹¦*/
delay(100);
PINSEL2=0x00000000;
delay(100);
IO1DIR=0XFFFFFFFF;
delay(100);
IO1CLR=0xFFFFFFFF;
VICIntEnClr = 0xffffffff;
VICIntSelect=0X0000000;
VICVectCntl1=0x20|0X0F;
VICVectAddr1=(int)IRQ_Eint1;
VICIntEnable=0x00008000;
while (1)
{
IO0SET=0xFFFFFFFF;
delay(70);
IO0CLR=0xFFFFFFFF;
delay(70);
} ;
} |