Timer Details: Configuring TIMER_A
Up/Down Mode
The UpDown count mode is similar to Up in that the counter only reaches the value in CCR0
before changing. In this case, though, it actually changes direction and starts counting down
rather than resetting immediately back to zero.
Not only does this double the time period (i.e. half the timer’s frequency), but it also spreads out
the two interrupts. Notice how CC0IFG occurs at the peak of the waveform, while TAIFG occurs
at the base of the waveform.
In our diagram we show all three counter mode waveforms. The UpDown mode is shown in red;
Up is shown in green; and the Continuous mode is shown in grey.
.
Which Count Mode Should I Use?
When using TIMER_A (or TIMER_B), you have a choice as to which counter mode to use. Here are
some things to keep in mind.
• Using Continuous mode doesn’t “tie up” your CCR0 register. It also means you don’t have
program the CCR0 register.
• Up mode allows you better control the timer’s frequency – that is, you can now control the time
period for when the counter resets back to zero.
• On the other hand, the UpDown mode not only lets you control the frequency better, but it also
allows for lower frequencies – since it effectively halves the frequency of the Up mode.
• Two more considerations of UpDown mode are:
− The two interrupts are spaced at ½ the time period from each other.
− When using multiple CCR registers, you can get two compare interrupts per cycle. (We’ll see more on this later.)
MSP430 Workshop - Timers 6 - 17