how do i detect a gpio interrupt??

i am using the msp430 stk2 kit from olimex which has the msp430449.

there is a sender msp430 which is intermittently
setting bit4 on the P2 port, which is on the EXT connector.

there is a receiver msp430 which should detect when a transition has
taken place
on the P2.BIT4 through the EXT connector.

this is my code for the receiver:

# include  <io.h>
# include  <signal.h>

int main(void)
{ 
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

  _EINT();                              // Enable interrupts

  P2DIR &= ~BIT4;              // input direction
  P2SEL &= 0x00;               // select gpio function

  P2IES &= ~BIT4;             // set p2bit4 for low-to-high transition
  P2IE |= BIT4;                  // enable interrupt on bit4 of port2
 
  while(1)
    {
         if ((P2IFG & BIT4) == BIT4)   // has interrupt flag been set
for bit4?
            {
                // do something here
                  P2IFG &= ~BIT4;            // unset interrupt flag
            }
    }
      
  return 0;
}

but this is not happening.
the receiver does not detect this interrupt.

am i doing something wrong?

thanks
karan
CM II
Resolution Systems Inc.

Reply via email to