I wanted to use the different capture and compare registers of "Timer A1" but I could not go inside the timer interrupt although I try to settup all the required functions. Am I missing something? I can go inside the interrupt when I use the TAIE overflow but not using the compare register values. I want to have many timer intterupts having different intervals. Is there another solution.
Inside the main function, I call init_TimerA1 once and I was hoping to use PortOn() and PortOff() functions below to start and stop a multiple timer interrupts of TimerA1 compare registers using "TIMER_A_enableCaptureCompareInterrupt()" and "TIMER_A_enableCaptureCompareInterrupt)" functions. But it keeps displaying 112-D statement is unreachablevoid init_TimerA1(void)
{
TIMER_A_clearTimerInterruptFlag(TIMER_A1_BASE);
TIMER_A_configureUpMode(
TIMER_A1_BASE,
TIMER_A_CLOCKSOURCE_SMCLK,
TIMER_A_CLOCKSOURCE_DIVIDER_64,
(0xFFFF),
TIMER_A_TAIE_INTERRUPT_DISABLE, //Not enabled because roll over interrupt is not needed
TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE, //not needed
TIMER_A_DO_CLEAR
);
// 2. Setup Capture & Compare features
TIMER_A_initCompare( TIMER_A1_BASE,
TIMER_A_CAPTURECOMPARE_REGISTER_3, // User CCR3 for compare
TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE, // can also be enabled later
TIMER_A_OUTPUTMODE_RESET_SET,
0x4000 // Compare value: 4000 = 1/4 second(does not matter)
);
TIMER_A_startCounter(TIMER_A1_BASE, TIMER_A_UP_MODE ); //start the timer
}
//function to enable the compare register interrupt
void PortOn()
{
TIMER_A_enableCaptureCompareInterrupt(TIMER_A1_BASE,TIMER_A_CAPTURECOMPARE_REGISTER_3);
}
//to disable the compare register interrupt
void PortOff()
{
TIMER_A_disableCaptureCompareInterrupt(TIMER_A1_BASE,TIMER_A_CAPTURECOMPARE_REGISTER_3);
}
//******************************************************************************
//
//This is the TIMER1 interrupt vector service routine.
//
//******************************************************************************
#pragma vector=TIMER1_A1_VECTOR
__interrupt void TIMER1_A1_ISR(void)
{
//Any access, read or write, of the TAIV register automatically resets the
//highest "pending" interrupt flag
switch ( __even_in_range(TA1IV, 14) ) {
case 0: break; //No interrupt
case 2: break; //CCR1 not used
case 4: break; //CCR2 not used
case 6: break; //CCR3 //WARNING shows: 112-D statement is unreachable
GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
case 8: break; //CCR4 not used
case 10: break; //CCR5 not used
case 12: break; //CCR6 not used
case 14:
break;
default: break;
}
}