#include "LPC11xx.h"
void PIOINT0_IRQHandler(void)
{
if (LPC_GPIO0->MIS & (1<<UPbutton_PIN) )
{
LPC_GPIO0->IC |= (1<<UPbutton_PIN); // clear interrupt for pin
}
}
int main(void) {
volatile static int i = 0 ;
/* INIT INT GPIO */
LPC_GPIO0->IS = (1<<UPbutton_PIN); // interrupt edge
LPC_GPIO0->IEV &= ~(1<<UPbutton_PIN); // falling edge generate interrupt
LPC_GPIO0->IE = (1<<UPbutton_PIN); // permission to interrupt
NVIC_EnableIRQ(EINT0_IRQn);
while(1) {
i++ ;
}
return 0 ;
}
|