EasyManuals Logo

Texas Instruments MSP430 Student Guide

Texas Instruments MSP430
398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #181 background imageLoading...
Page #181 background image
(Optional) Lab 4b Exploring the Watchdog Timer
File Management
8. Import the solution for lab_02a_ccs.
Project Import Existing CCS Eclipse Project
Use the archived solution file:
C:\msp430_workshop\
<target>\solutions\lab_02a_ccs_solution.zip
9. Rename the project to: lab_04b_wdt
10. Build the project, just to verify it still works correctly.
11. Import DriverLib into your project and add the appropriate path to the compilers
#include search path setting.
If you need a reminder on how to do this, look back at Lab3a under the heading:
“Add MSP430ware Driverlib”
12. Build the project, to verify the library was added correctly.
Fix any errors and test until the program builds without any errors.
Edit the Source File
13. First, let’s modify the printf() statement.
Next, we want to modify the print statement so that it shows how many times it has been
executed.
a) Add a global variable to the program.
uint16_t count = 0;
b) Replace printf() statement with the following while{} loop:
while (1) {
count++;
printf("I called this %d times\n", count);
}
14. Build the code to make sure it’s still error free. Fix any errors it finds.
15. Replace the watchdog hold code with the two WDT_A functions written earlier.
Remember that we didn’t actually write this code. It ‘holds’ the watchdog by using register-
based syntax. So, this is the line you want to replace:
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
This new code will initialize the watchdog timer using the clock and divisor of our choice; then
start the watchdog timer running. (See question in step #1 on page 4-54.)
MSP430 Workshop - MSP430 Clocks & Initialization 4 - 55

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals