lpcware

Use interrupts with LPC1788

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by il_mix on Mon Sep 10 08:34:01 MST 2012
Hi everyone,
that's a simple one, I suppose.
I have a custom board with a button connected to P0.20. I'm able to read the button status in polling mode, by setting it as an input GPIO


main()
{

  [...]

  PINSEL_ConfigPin(0,20,0);
  GPIO_SetDir(0, (1<<20), 0);
  while(1)
  {
    delay();
    intValue = GPIO_ReadValue(0);
    if((intValue & (1<<20)) == 0)
    {
      // DO SOMETHING
    }
  }

}


I'm not able to map an interrupt on this button.
I tried several ways, but I can't catch anything.
Here is an example code, based on various demos


void EINT0_IRQHandler(void)
{
  // DO SOMETHING
}
void FunctionBtnIRQ_Init()
{
  // Set P0.20 as input GPIO
  PINSEL_ConfigPin(0,20,0);
  GPIO_SetDir(0, (1<<20), 0);

  // Enable interrupt
  GPIO_IntCmd(0,(1<<20),1);
  NVIC_EnableIRQ(EINT0_IRQn);
}
main()
{

  [...]

  FunctionBtnIRQ_Init();

  [...]

}


The EINT0_IRQHandler function will never be called when I click the button.


How to let it works?

Thanks a lot
MIX

Outcomes