This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

External Interrupts Not Working

Other Parts Discussed in Thread: Z-STACK

I can't get an external interrupt to trigger when I press S1 on the CC2430DB (P0_1).  I'm using the Z-Stack 1.4.2-1.1.0 with IAR v7.20i.  Here's the code I'm using:

 

#pragma vector=P0INT_VECTOR
__interrupt void P0_IRQ(void){
    P0IFG = 0x00;
    P1=0;                       // Turn on LED
    IRCON = 0x00;       // Clear flags
}

ZSEG int main( void ) // from Zmain.c
{

  P0DIR = 0;
  P1DIR = 0x01;

  P0IFG = 0x00; // clear interrupt flag
  PICTL |= 0x08; // enable interrupt on P0_0 to P0_3 
  PICTL |= 0x01; // enable falling edge interrupt    
  P0IFG = 0x00; // clear interrupt flag

  IEN1 |= 0x20; // enable PO interrupt
  EA = 1;

  ...

Tracing the program shows that all registers are setup properly and that the button is working.  However, the ISR is never entered.  Any ideas?

  • I don't see where in your code you are setting the global interrupt enable bit (IEN0 |= 0x80).  Make sure that you set this bit, otherwise the interrupt will not be enabled.  Also, you are probably going to want to add a delay in the interrupt processing routine to back off from reseting the interrupt so that you don't have problems with bounce.