MSP430F6721
CCS
I’ve created a simple interrupt handler in C that is driven from TIMER0_A0 (driven from SMCLK @32kHz). The timer is set to interrupt every 0.125 seconds.
When I first wrote this, I intended the variable uiATIV to be used, but the first implementation merely left the variable initialized but otherwise not used.
I’ve since decided it won’t be needed, so I removed it.
With the statement
unsigned int uiTAIV = TA0IV;
commented out, this routine is still triggered, but the switch statement never hits TA0IV_NONE. Instead it hits TA0IV_TA0IFG which seems strange indeed.
Thinking this is a weird timing issue, I threw some __no_operation() statements in place of the uiTAIV statement, but no luck.
Rather than continue depending upon this interrupt processing code, I’d rather know why before implementing an unintended workaround. Any ideas out there??
Note: no LPM state is being issued at this time.
#pragma vector=TIMER0_A0_VECTOR
#pragma vector=TIMER0_A1_VECTOR
__interrupt void Timer_A(void)
{
unsigned int uiTAIV = TA0IV;
// accept only even number vectors up to TA0IV_TA0IFG
switch (__even_in_range(TA0IV, TA0IV_TA0IFG))
{
// TimerA_0 0.5 second vectors here
case TA0IV_NONE:
ReadButtonState();
++SYSControl.buttonPhase;
P1OUT ^= 0x01; // Toggles P1.0 every half second
DoProcessLoop();
__no_operation();
break;
case TA0IV_TA0CCR1: // TACCR1 TIMERA1_VECTOR
//P1OUT ^= 0x01; // Toggles P1.0 every half second
__no_operation();
break;
case TA0IV_TA0CCR2: // TACCR2 TIMERA1_VECTOR
__no_operation();
break;
case TA0IV_TA0IFG: // Timer_A3 overflow TIMERA1_VECTOR
__no_operation();
break;
}
}