O'Reilly logo

Microcontroller Programming and Interfacing Texas Instruments MSP430 by Daniel J. Pack, Steven F. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.12. SUMMARY 215
During the acceleration period, you must add 216 to the current value in TACCR2,
which will increase the duty cycle at each of the 152 changes between time 0 to 3 seconds,
assuming that the TTCCR2 value started with 0000h. During the deceleration period,
the opposite action must occur. At each pulse, the value in TACCR2 is decremented by
216 counts. At the end of the three second period of deceleration, the duty cycle decreases
to zero.
Measuring the number of pulses arriving at an input capture pin.
Use the input capture system P1.1 to monitor the incoming pulses. You should connect
P1.2 to P1.1, which feeds the output compare signal back to input capture pin. Use the
TACCTL1 register to configure the input capture system to capture each pulse entering.
By counting the pulses, we can keep tract of the current time with respect to the desired
time profile. Thus, during the first 152 pulses, the input capture system interrupt should
be the one who modifies the TACCR2 register contents. During the next 152 pulses,
no changes should be made to the TACCR2 register, and during the last 152 pulses, the
value in TACCR2 should be decreased by 216 counts after each pulse arrives on the P1.1
pin using the input capture interrupt.
Once the controller is configured with the steps shown above,the P1.2 pin should be connected
to an oscilloscope, and the output waveform with varying duty cycle should be verified.
6.12 SUMMARY
In this chapter, we showed the clock system of MSP430 microcontrollers and the timer related
capabilities to include the watchdog timer, basic timer, real time clock, input capture system, output
compare system, and pulse-width modulation system. The architects of the controller seek to pro-
vide embedded system designers with flexibility and minimum power usage by implementing three
different clock signal generators (LFX1CLK, XT2CLK, and DCOCLK) and three clocks (ACLK,
MCLK, and SMCLK) that can be configured to select one of the three clock signal generators. The
controller also allows peripheral systems, which usually run slower the CPU, to run on a separate
clock (ACLK), different from the clock used by the central processing unit, allowing the minimum
use of power. This chapter also showed how the watchdog timer can be used either to maintain
software execution integrity or to generate periodic time intervals.
The MSP430F series controllers contain an extra timer, called the basic timer, which can be
used to track time period or to trigger an internal event based on a programmed time period. The
real-time clock is used to keep track of calendar time with ability to inform year, month, day, hour,
minute, and second.The input capture and output compare capabilities of the controller are used to
interact with external world with time related events. The input capture system can capture the time
of an incoming event, which can be used to measure the pulse width of a signal and compute the
period or frequency of an incoming periodic signal. The output compare system is used to generate

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required