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 #242 background imageLoading...
Page #242 background image
Lab 5 Interrupts
c) Click the link to “Import the example project into CCS”.
Once imported you can close the TI Resource Explorer, if you want to get it out of the way.
d) Rename the imported project to: lab_05b_wdtBlink
While not required, this should make it easier to match the project to our lab files later on.
2. Open the lab_05b_wdtBlink.c file. Review the following points:
Notice the DriverLib function that sets up the
WDT_A for interval timing.
You can choose which clock to use; we selected
ACLK. By the way, what speed is ACLK running at?
(This example uses ACLK at the default rate.)
As described, dividing ACLK/8192 gives us an
interval of ¼ second.
The WDT_A is a system (SYS) interrupt, so it’s
IFG and IE bits are in the Special Functions
Register. It’s always good practice to clear a the
flag before enabling the interrupt. (Remember,
CPU won’t be interrupted until we set GIE.)
Along with enabling interrupts globally (GIE=1), this
example puts the CPU into low power mode (LPM3).
When the interrupt occurs, the CPU wake up and
handles it, then goes back into LPM3. (Low Power
modes will be discussed further in a future chapter.)
Hopefully this ISR is straight-forward. It uses the
#pragma to set up the vector; and, it manages
the context using the __interrupt keyword.
Since WDT has a dedicated interrupt vector, the
code inside the ISR is simple. We do not have to
manually clear the IFG bit, or use the IV vector
to determine the interrupt source.
These GPIO functions
should be familiar by
now …
5 - 52 MSP430 Workshop - Interrupts

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