Part Number: MSP430F5529
Tool/software: Code Composer Studio
I am basically trying to make a nested interrupt with this one. I have the WDT ISR working correctly with the correct timing, but the PORT2_ISR doesn't call right (or at all I think). I can uncomment line 27 and comment line 26, and the LED will toggle perfectly. When I try to do it with the nested ISR, however, it does nothing.
#include <msp430.h>
int i = 0;
void main(void)
{
WDTCTL = WDTPW | WDTSSEL__SMCLK | WDTIS__512 | WDTTMSEL; // Set WDT 0.5ms interval
P4DIR |= BIT7; // Set P1.0 to output direction (LED2)
P4OUT &= ~BIT7; // LED2 initially OFF
SFRIE1 |= WDTIE; // Enable WDT interrupt
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
P2IE |= BIT1; // enable interrupt at P2.1
P2IES |= BIT1; // enable hi->lo edge for interrupt
P2IFG &= ~BIT1; // clear any erroneous interrupt flag
}
// Watchdog Timer Interrupt Service Routine
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
{
if(i <1000)
i++;
else
{
i = 0;
P2IFG |= BIT1;
//P4OUT ^= BIT7;
}
}
#pragma vector = PORT2_VECTOR //SW1 ISR
__interrupt void PORT2_ISR(void)
{
P2IFG &= ~BIT1; // Clear the flag
P4OUT ^= BIT7; // Toggle LED2
}