Omkar_Trivedi
Newbie level 1
hey can anyone please help me ASAP in finding what is wrong with this interrupt program.
Im trying to turn a led on by using External interrupt.
Here is the code:
Im trying to turn a led on by using External interrupt.
Here is the code:
Code:
#include <lpc214x.h>
#include <string.h>
#define CR 0x0D#include <stdio.h>
void ExtInt_Serve2(void)__irq;
/*----------------------------------< INT Initialization >------------------------------*/
void ExtInt_Init2(void)
{PINSEL0 |= 0x80000000;
VICIntSelect = 0x00;
EXTMODE |= 4; //Edge sensitive mode on EINT2
EXTPOLAR = 0; //Falling Edge Sensitive
//Enable EINT2 on P0.15
VICVectCntl1 = 0x20 | 16; //Use VIC0 for EINT2 ; 16 is index of EINT2
VICVectAddr1 = (unsigned long) ExtInt_Serve2; //Set Interrupt Vec Addr in VIC0
VICIntEnable |= 1<<16; //Enable EINT2
}
void DelayMs(unsigned int count)
{
unsigned int i,j;
for(i=0;i<count;i++)
{
for(j=0;j<1000;j++);
}
}
void main()
{
PINSEL0 |= 0x80000000;
IO0DIR = 0X000000ff;
ExtInt_Init2(); //Initialize Interrupt 2
}
void ExtInt_Serve2()__irq
{
IOSET0=0X000000ff;
EXTINT |= 4;
VICVectAddr = 0;
}