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

266 8. ANALOG PERIPHERALS
1. Configure DAC12 to operate in an 8 bit binary format.
2. Use reference voltages to be 0 V and 2.5 V.
3. Program the MSP430 microcontroller to monitor shower input (suppose inputs are updated
in a memory location at the top of RAM).
4. Convert digital values to their corresponding analog values when the contents of the memory
location mentioned in 2 are changed.
8.8 REFERENCES AND FURTHER READING
Texas Instruments MSP430x5xx/MSP430x6xx Family User’s Guide (SLAU208G). Texas In-
struments: 2010.
Texas Instruments MSP430x4xx Family User’s Guide “RISC 16-Bit CPU (SLAU056J). Texas
Instruments: 2010.
8.9 CHAPTER PROBLEMS
Fundamental
1. Using the Nyquist sampling rate, find the minimum sampling frequency of an ATD converter
if the highest frequency of an input analog signal is 2 kHz.
2. Given a sinusoidal input analog signal, 5cos(2π10kt), and sampling frequency of 1 KHz, find
the first three sampled values with starting time 0.
3. Given an 8 bit ATD converter and input range of 0 V and 5 V, what is the quantization level
for sampled value of 2.9 V?
4. What is the quantization error for the sampled signal in Problem 3?
5. What is the encoded value of quantization level from Problem 3?
6. Which of the following digital-to-analog converter does MSP430 use: (1) Binary weighted
DAC, (2) R/2R ladder DAC, (3) Interpolating DAC, (4) Pulse width modulation DAC, or
(5) Thermometer coded DAC?
7. Which register and bit should be modified to configure the DAC12 to use a 12-bit resolution?
8. What must a user do to configure the DAC12 to update analog output whenever there appears
a rising edge of the Timer_A CCR1 output?
8.9. CHAPTER PROBLEMS 267
Advanced
1. Write a program segment using the ADC12 converter to (1) operate with the 12 bit resolution,
(2) use internal reference voltages of 2.5V and 0V, (3) continuously sample analog signals from
pins A0 and A1, (4) use the unsigned binary format, (5) compare the input analog values,
(6) turn the logic state on Pz.x pin high if the signal on A0 is higher than the one on A1;
otherwise, turn the logic state low, and (7) turn the logic state on Pz.y pin high if the signal
on A1 is higher than the one on A1; otherwise, turn the logic state low.
2. Write a program segment using the DAC12 converter to (1) operate with the 8 bit resolution,
(2) use external reference voltages, (3) calibrate the output before being used, (4) update the
output analog value whenever a new value arrives at the DAT12_0DAT register, and (5) use
the unsigned binary format.
Challenging
1. Present your design and write a program to construct a smart home that locate your position in
room whose size is 10 ft wide, 10 ft long, and 9 ft high. Assume that you need to use Infrared
sensors to do the job. You can use as many sensors as you need but want to minimize the
number used. Suppose the Infrared sensor output is fed to an ADC12 converter of a MSP430
and you have means to communicate among MSP430s. Design the sensor positions and write
a program to locate a person in the room.

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