Use interrupts with LPC1788

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use interrupts with LPC1788

980 Views
lpcware
NXP Employee
NXP Employee
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
0 Kudos
Reply
2 Replies

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by il_mix on Tue Sep 11 00:08:46 MST 2012
GPIO_IRQHandler(), ah? ...interesting.

Well, I made some tests starting from demo/examples, than I studied the UM to better understand the topic, but still didn't get a result.
The problem was that I didn't use the GPIO_IRQ.
Why several examples seems to use the EINTn_IRQ instead of the GPIO one?
0 Kudos
Reply

896 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Sep 10 11:24:24 MST 2012

Quote: il_mix
How to let it works?



:confused:

Your UM10470 is describing:

#1 How to enable desired GPIO Interrupts in Table 88. GPIO interrupt register map :)

#2 How to use GPIO_IRQHandler() to read and clear GPIO interrupts :):)
0 Kudos
Reply