MSP430 Peripherals
Timers
As stated earlier, timers are often thought of as the heartbeat of an embedded system. The MSP430
contains a number of different timers that can assist you with different system needs.
Timer _A (covered in detail in Chapter 6) is the original timer found across all MSP430 generations.
And there is a reason for that, it is quite powerful, as well as flexible.
These 16-bit timers contain anywhere from 2 to 7 capture/compare registers (CCR). Each CCR can
capture a time value when triggered (capture mode). Alternatively, each CCR could be used to
generate an interrupt or signal (internal or external via a pin) when the timer’s counter (TAR) matches
the value in the CCR (compare mode). Oh, and each CCR is independently programmable – thus
some could be used for capture while others for compare.
Using the CCR feature, it is easy to create a host of complex waveforms – for example, they could be
used to generate PWM outputs. (Something we’ll explore in Lab 6.)
Timer_B is nearly similar to Timer_A. It provides the ability to use the internal counter in 8/10/12 or 16-
bit modes. This affords it a bit more flexibility. Additionally, double-buffered CCR registers, as well as
the ability to put the timer outputs into high-impedance, provide a couple of additional advantages
when driving H-bridges and such.
Timer_D takes Timer_B and adds a higher resolution capability. (BTW, we’re not sure what happened
to Timer_C…)
RTC (real-time clock) peripherals not only provide a time base, but their calendar and alarm modes
make them ideal for clock/calendar types of activities. More importantly, they have been designed to
run with extremely low power. This means they can provide a heartbeat while the rest of your system
is asleep.
Watchdog timers provide two different functions. In their namesake mode, they act as failsafe’s for the
system. If your code does not reset them before their counter reaches the end, they reset the system.
This functionality is ALWAYS enabled at boot. You can also choose to use them as an interval timer.
MSP430 Workshop - Introduction to MSP430 1 - 23