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

216 6. TIMER SYSTEMS
desired events on external pins at a desired time. For example, the system can generate a logic change,
a pulse, a periodic pulse with a desired duty cycle. The timer system with its clock system and the
capture/compare capabilities allows programmers to implement any time critical applications using
MSP430.
6.13 REFERENCES AND FURTHER READING
Texas Instruments MSP430F543x, MSP430F541x Mixed Signal Microcontroller (SLA612C).
Texas Instruments: 2010.
Texas Instruments MSP-EXP430F5438 Experimenter Board (SLAU263D). Texas Instruments:
2009.
Texas Instruments MSP430x4xx Family User’s Guide “RISC 16-Bit CPU (SLAU056J). Texas
Instruments: 2010.
Barrett S,Pack D (2010) Embedded Systems Design with the Atmel Microcontroller. Morgan
and Claypool Publishers.
Texas Instruments MSP430FG461x Code Examples, slac118d, www.TI.com.
6.14 CHAPTER PROBLEMS
Fundamental
1. What is the motivation for having three clock signal generators and three different clocks in
MSP430 controllers?
2. To save power usage, how does one turn off the LFXT1CLK clock signal generator?
3. We want to configure the MCLK clock to run on the XT2CLK clock signal generator. Which
register should be modified? What value should be in the register?
4. Suppose the LFXT1CLK is connected to a high frequency watch crystal. Identify the register
and the particular bit to configure the LFX1CLK clock signal generator on a high frequency
mode.
5. How does one select the clock for the Basic Timer?
6. The Basic Timer 2 (BTCNT 2) has two scaling factors, which control register is used for the
two scaling factors?
7. What is the password value and where should you write it to access the Watchdog timer system
control register?
6.14. CHAPTER PROBLEMS 217
8. Give an example application where one might use the count UP/Down count mode for the
free running counter, TAR.
9. The TAIFG flag when set indicates the free running counter TAR reached its limit. Why
would you not want the flag to set when you are operating in the Up/Down counter mode?
Advanced
1. Program your MSP430 to generate clock signal frequency of 1.2 MHz.
2. Program your MSP430 controller to accept a pulse on the P1.0 pin and compute the pulse
width.
3. Given a periodic pulse-width input signal, write a segment of code to compute the duty cycle
using the input capture interrupt system of the MSP430 controller.
4. Program your MSP430 controller to generate a pulse (0v to 5v and back down to 0v) with
2ms width using the Timer_A system.
5. Program your MSP430 using Timer_B system to generate a pulse-width modulated signal
with frequency of 50 Hz and duty cycle of 40 %.
Challenging
1. Program your MSP430 to accept any input periodic signal with varying frequency ranging
from 10 Hz to 1000 Hz and compute the input signal frequency.
2. Write a program that only activates itself if your MSP430 controller receives a 200 usec pulse
(10% tolerance on the pulse width) from an external device on P1.0 pin, updates the number
of times the designated pulse was received, displays the number on an LCD display unit for 5
seconds, and ’sleeps’ until the next pulse arrives.

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