Friday, 30 October 2015

EXTERNAL INTERRUPT PROGRAMMING OF LPC2129/38(ARM7)

#include<lpc21xx.h>
void delay();
__irq void extint();
int main()
{
 IO0DIR=0;
IO1DIR=0XFFFFFFFF;
PINSEL0=0X0000000C;
//PINSEL1=0X00000001;
//EXTINT=0X0;
//EXTMODE=0X00;
//EXTPOLAR=0X01;
VICVectCntl0=0x0000002E;
  VICVectAddr0=(unsigned)extint;
 //VICIntSelect=0x00000000;
VICIntEnable=0x00004000;
EXTINT=0X01;

while(1)
{ //EXTINT=0X01;
delay();
}

}
void extint()__irq
{

IO1CLR=0XFFFFFFFF;
delay();
IO1SET=0XFFFFFFFF;
delay();
  VICVectAddr=0;


}
void delay()
{
int i,j;
//for(j=0;j<k;j++)
for(i=0;i<10000;i++);
}


No comments:

Post a Comment