How to use external pin interrupts

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by emielzij on Sun Jan 25 11:57:45 MST 2015
I want to trigger an ISR if an external pin changes state.

This is my code at the moment:

#include "lpc11xx.h"

int main(void)
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 16);//Enable iocon clock

LPC_IOCON->PIO0_1&= 0xFFFFFFF8;//PIO0_1 as standard GPIO

LPC_GPIO0->DIR &= ~(1 << 1);//PIO0_1 as input

LPC_GPIO0->IS &= ~(1 << 1);//PIO0_1 as edge sensitive

LPC_GPIO0->IBE |= (1 << 1);//Both edges trigger an interrupt

LPC_GPIO0->IE|= (1 << 1);//Not mask the interrupt of this pin anymore



    return 0 ;

void EINT0_IRQHandler(void)
//Check which pin triggered an interrupt
        //Some code
        //Clear interrupt flag

I know that some statements are redundant.

How can I check which pin is interrupted in the isr, is this the GPIOnRIS register?
And in which register do I need to clear the interrupt at the end of my ISR?