The header defines symbols for the TAIV
values; use them.
The XxxLEDToggle
defines are complete statements; you should not treat them as expressions by combining them with |
.
The interrupt handler can be called from multiple sources.
At the moment, your program does not enable any others, but this is likely to change, so you should run your TAIFG-specific code only when TAIFG actually was set.
Once you have reached the limit, you need to reset the counter back to zero.
When you have multiple timer intervals, you need multiple counters. Otherwise, the first reset will reset the counting for all intervals.
You need something like this:
static unsigned int counter_10 = 0;
static unsigned int counter_60 = 0;
#pragma vector=TIMER0_A1_VECTOR
static __interrupt void Timer_A0(void)
{
switch (TA0IV) {
case TA0IV_TACCR1: break;
case TA0IV_TACCR2: break;
case TA0IV_TAIFG:
if (++counter_10 >= 10) {
counter_10 = 0;
RedLEDToggle;
}
if (++counter_60 >= 60) {
counter_60 = 0;
GreenLEDToggle;
}
break;
}
}