(Extra Credit) Lab 6b – Timer using Up Mode
3. Modify your previous code. We need to clear both interrupts and start the timer.
We copied the code from the previous lab into this question. It needs to be modified to meet
our new objectives for this lab.
Here are some hints:
− Add an extra line of code to clear the CCR0 flag (we left a blank space below for this)
− Don’t make the mistake we made … look very carefully at the ‘start’ function. Is there
anything that needs to change in that function call?
// Clear the timer flag and start the timer
TIMER_A_clearTimerInterruptFlag( TIMER_A0_BASE ); // Clear TA0IFG
________________________________________________________________________
TIMER_A_startCounter( TIMER_A0_BASE, // Start timer
TIMER_A_CONTINUOUS_MODE ); // in ____________ mode
4. Add a new ISR to toggle the Red LED when the CCR0 interrupt fires.
On your Launchpad, what Port/Pin number does the Red LED use? ______________
Here we’ve given you a bit of code to get you started:
#pragma vector= _________________________________
__interrupt void ccr0_ISR (void)
{
// Toggle the Red LED on/off
_______________________________________________________________
}
Please verify your answers before moving onto the lab exercise.
6 - 46 MSP430 Workshop - Timers