Hi , I m new to CORTEX M3 , and was trying to get the GPIO interrupts functionality on LPC1768 working, however , it doesnt seem to work, seems like the interrupt isn't enabled.
Here is my code :
#include<lpc17xx.h>
int main() { SystemInit() ; LPC_GPIO1 -> FIODIR |= (1<<1) ; LPC_GPIO0 -> FIODIR &= ~(1<<0) ; LPC_GPIOINT -> IO0IntEnR = (1<<0) ; LPC_GPIOINT -> IO0IntClr = (1<<0) ; NVIC_ClearPendingIRQ(EINT3_IRQn) ; NVIC_EnableIRQ(EINT3_IRQn) ;
while(1) { LPC_GPIO1 -> FIOSET0 = (1<<1) ; }
return 0 ; } void EINT3_IRQHandler() { int a = LPC_GPIOINT -> IO0IntStatR ; if(a & 0x01) { LPC_GPIO1 -> FIOCLR = (1<<1) ; } LPC_GPIOINT -> IO0IntClr = (1<<0) ; }
Can anyone please tell me, what am I doing wrong? Thanks!