97
/*
* TA0CTL, Timer_A3 Control Register
*
* TASSEL_2 -- SMCLK
* ID_3 -- Divider - /8
* MC_2 -- Continuous Mode
*/
TA0CTL = TASSEL_2 | ID_3 | MC_2;
We want to blink the Launchpad board’s LEDs at the rate of 250 milliseconds. Thus, we need to check
or compare if the counter register TA0R has gone past 50% of the full scale 16-bit value. This is an
event marker because with reference to this mark, we toggle the states of the LEDs. The idea shown
here is actually the concept with which PWMs are generated by compare-match principle inside timer
hardware and so it is worth understanding this idea.
if(TA0R >= 32768)
{
P1OUT |= BIT6;
P1OUT &= ~BIT0;
}
else
{
P1OUT |= BIT0;
P1OUT &= ~BIT6;
}