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.

Interrupt driven active mode and sleep mode in Z-stack

Other Parts Discussed in Thread: Z-STACK

Hi,

I have a requirment  to design the Z-stack for our product where I need to have a Interrupt driven mode of operation as soon as the device starts up.

port 2.5 bit is set high when when the device is battery operated and set to 0 when AC powered.

Based on this bit i need an ISR to have the device go into active mode when AC__powered and into LPM4 when battery operated and when power is switched from battery to ac device should wake up...i am using MSP430xxx series.

 

I noticed in Z-stack that they use some Interrupt_Function based ISRs...

 

has anyone used these .....I am not able to write an ISR in Z-stack for some reason it doesn't go into the ISR...

my sample code in like this...

//============================================================================//
//  ISRs
//============================================================================//

__interrupt void PORT_2(void);

#pragma vector=PORT2_VECTOR
__interrupt void PORT_2(void)
{
  if(P2IFG & BIT5)
  {
  cnt = 10000;
  P2IFG = 0x00;   // Clear P2 interrupt flag
  }
 // __bis_SR_register( __SR_GIE);
}

 

//============================================================================//
int Test_AC_Power_Fail() {
  P2SEL &= 0xDF; //Select P2.5 as GPIO with bit value 0
  P2DIR &= 0xDF; //Set P2.5 as Input with bit value 0
  P2IES &= 0xDF; //Set P2.5 for rising-edge action with bit value 0
  // Clear P2 interrupt flag
  P2IFG = 0x00;
  // Enable Interrupt
  P2IE |= 0x20;
  // Set global interrupts
  __bis_SR_register(__SR_GIE);
 
  cnt = 40000;
 
  return (tPASS);
}

It has been changed a lot to see if it does loop but it doesnt.....

can anyone help me.......very urgent..........

  • Based on the Test_AC_Power_Fail() routine you published, you are trying to generate an interrupt on P2.5 when it transitioned from low-to-high, correct?

    Have you checked the map file to ensure the address of the routine PORT_2() is at the appropriate interrupt vector location for the MSP430 device you are using?

  • well the interrupt vector for PORT 2 is PORT2_vector in the header file msp430x54xx.h as   #define PORT2_VECTOR        (42 * 2u) /* 0xFFD4 Port 2 */

     

    but i have seen tht this interrupt vector is being used by other functions too......would tht make a difference

     

     

  • maha said:

    well the interrupt vector for PORT 2 is PORT2_vector in the header file msp430x54xx.h as   #define PORT2_VECTOR        (42 * 2u) /* 0xFFD4 Port 2 */

    but i have seen tht this interrupt vector is being used by other functions too......would tht make a difference

    That is definitely confusing, as the interrupt vector at 0xFFD4 will only have one address to jump to.  If that address is not the address of the PORT_2() ISR, then the PORT_2() will not get executed.

    What code base are you referencing in your application?