Software Examples
3.1.1
Source File Structure
The project is split into multiple files. This makes it easier to navigate and reuse parts of it for other
projects (see
Table 8. Source File and Folders
Name
Description
main.c
The out-of-box demo main function, initializations, shared ISRs, and other functions
hal_LCD.c
Hardware abstraction layer for LCD
StopWatchMode.c
Main function file for stopwatch mode
TempSensorMode.c
Main function file for live thermometer mode
Library: Driverlib
Device driver library (
http://www.ti.com/tool/msp430driverlib
3.1.2
Power-up and Idle
Upon powering up the out-of-box demo, the LCD displays a scrolling welcome message. The
MSP430FR6989 then enters a loop, in which the LCD cycles through all of its segments followed by a
scrolling instruction message to "Hold S1 and S2 to switch modes".
3.1.3
Stopwatch Mode
While in the power up and idle state or in the temperature sensor mode, the stopwatch mode can be
entered by holding down both S1 and S2 buttons shortly. The LCD displays scrolling text "STOPWATCH
MODE" to indicate successful entry into this mode.
The MSP430FR6989 initializes the stopwatch calendar to HH:MM:SS:CC = 00:00:00:00, then goes to
sleep in LPM3. Because the onboard LCD has six alphanumeric digits, the stopwatch format is initially
MM:SS:CC, but will become HH:MM:SS when the timer reaches the first hour. This stopwatch counts up
to 23h59m59s before resetting back to 00h00m00s.
By pressing the S1 button, the user can start the stopwatch timer (counts up). While the timer is running,
the MSP430FR6989 sleeps and wakes between LPM3 (waiting for RTC interrupt) and active mode
(incrementing calendar and updating LCD). Pressing the S1 button again will stop the stopwatch timer and
returns the MSP430FR6989 back to LPM3 to conserve power. When the stopwatch timer is stopped,
pressing S2 button will reset the timer back to 00:00:00.
While the stopwatch timer is running, pressing S2 button pauses the LCD at the current time but keeps
the timer running in the background, allowing for the "Split timer" functionality. LCD can be resumed to the
running timer by pressing S2 button again.
3.1.4
Temperature Sensor Mode
While inside the stopwatch mode, the temperature sensor mode can be entered by holding down both S1
and S2 buttons shortly. The LCD displays scrolling text "TEMPSENSOR MODE" to indicate successful
entry into this mode.
Upon entering this mode, the MSP430FR6989 initializes the ADC input to its internal temperature sensor
and starts sampling and conversion at four times per second. Each time an ADC conversion completes,
the LCD shows the calculated temperature to the tenths decimal place.
The temperature unit can be toggled between Celsius and Fahrenheit by pressing the S2 button.
The temperature measurement can also be paused or resumed by pressing the S1 button. While the
temperature measurement is running, the MSP430FR6989 sleeps and wakes between LPM3 (waiting for
ADC sample and conversion to finish) and active mode (processing the results and updating LCD). When
the temperature measurement is paused, the MSP430FR6989 enters LPM3 with the LCD remaining on,
displaying the last measured temperature.
19
SLAU627A – May 2015 – Revised July 2015
MSP430FR6989 LaunchPad™ Development Kit (MSP
‑
EXP430FR6989)
Copyright © 2015, Texas Instruments Incorporated