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..........