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

324 10. SYSTEM LEVEL DESIGN
Proportional speed control with bi-directional motor control. Both of these advanced features
may be provided by driving the H-bridge circuit with PWM signals. This modification is
given as an assignment at the end of the chapter.
10.2 WEATHER STATION
In this project, we design a weather station to sense wind direction and ambient temperature.
The sensed values will be displayed on a liquid crystal display (LCD) in Fahrenheit degrees. The
wind direction will also be displayed on LEDs arranged in a circular pattern. The wind direction
and temperature will also be transmitted serially from the microcontroller to an MMC/SD flash
memory card for data logging.
10.2.1 REQUIREMENTS
The requirements for this system include:
Design a weather station to sense wind direction and ambient temperature.
Sensed wind direction and temperature should be displayed on an LCD.
Sensed temperature should be displayed in the Fahrenheit temperature scale.
Wind direction should be displayed on LEDs arranged in a circular pattern.
Wind direction and temperature should also be transmitted serially from the microcontroller
to an MMC/SD card for storage.
10.2.2 STRUCTURE CHART
To begin, the design process, a structure chart is used to partition the system into definable pieces.
We employ a top-down design/bottom-up implementation approach. The structure chart for the
weather station is provided in Figure 10.6. The three main microcontroller subsystems needed for
this project are the UART for serial communication, the ADC12 system to convert the analog
voltage from the LM34 temperature sensor and weather vane into digital signals, and the wind
direction display. This display consists of a 74HCT154, 4-to-16 decoder and 16 individual LEDs
to display wind direction. The HCT series of digital logic is chosen because it may be operated at
3.3 VDC. The system is partitioned until the lowest level of the structure chart contains “doable”
pieces of hardware components or software functions. Data flow is shown on the structure chart as
directed arrows.
10.2.3 CIRCUIT DIAGRAM
The circuit diagram for the weather station is provided in Figure 10.7.The weather station is equipped
with two input sensors: the LM34 to measure temperature and the weather vane to measure wind
10.2. WEATHER STATION 325
Weather Station
ADC12
LM34
temp sensor
weather
vane
ADC12
Initialize
ReadADC12
ch for
conv
conv
data
wind
direction
temp
data
UART
Initialize
UART
Transmit
data
for TX
UART
74HCT154
4:16 decoder
LED
interface
Wind Direction
Display
wind
direction
LCD
Display
data for
storage
data for
display
MMC/SD
card
Figure 10.6: Weather station structure chart.
direction. Both of the sensors provide an analog output that is fed to the MSP430F5438 on pins P7.4
and P7.5.The LM34 provides 10 mV output per degree Fahrenheit.The weather vane provides 0 to
3.3 VDC for 360 degrees of vane rotation. The weather vane must be oriented to a known direction
with the output voltage at this direction noted. We assume that 0 VDC corresponds to North and
the voltage increases as the vane rotates clockwise to the East. The vane output voltage continues to
increase until North is again reached at 3.3 VDC and then rolls over back to zero volts. All other
directions are derived from this reference point.
An LCD will be used to display weather data. The MSP430F5438 experimenter board is
already equipped with a 138 x 110 dot matrix LCD. The MSP430F5438 User Experience Demo
software also provides software support for the LCD.In this project,we equip the experimenter board
with an external LCD. LCD displays are available in two different configurations: parallel and serial.
A parallel LCD requires 8 data pins and 2 control lines for operation. Most operate at 5 VDC. In this
project, we employ a serial configured LCD,the SerLCD V2.5, by Spark Fun Electronics. Spark Fun
has equipped a parallel LCD with a serial interface using an onboard, piggyback microcontroller.
Data and commands are sent to the SerLCD via 3.3 VDC, 9600 BAUD via the MSP430 UART
[SparkFun]. A partial command set for the SerLCD is provided in Figure 10.7.
1
1
Serial configured 3.3 VDC LCDs are also available from other manufacturers. Each has their own specific interface requirements
and command sets.

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