EasyManuals Logo

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 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 #134 background imageLoading...
Page #134 background image
134
Time Delay Generation with Timer Compare-Match Feature
Time-bases and delays can be generated in many different ways, ranging from software techniques to
using a dedicated hardware timer. Between software-based methods and hardware-based ones, the
latter is more efficient and effective. This is because software-based methods rely on wasteful CPU-
intensive loops and other resource-consuming processes. Hardware approaches for generating time-
bases and delays are smart choices because the prime job of a timer is to count ticks or measure time.
Yet within hardware-based methods, there are several techniques and tricks. We can choose between
polling a free running timer or using interrupts to get things done in a more real-time sense. We have
seen previously that we can use timer interrupts to time events. Here we will also see the same but
this time compare-match interrupt is used instead of timer interrupt.
Code Example
#include <msp430.h>
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void Timer0_A3_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
#pragma vector = TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR_HOOK(void)
{
P1OUT ^= (BIT0 | BIT6);
__bic_SR_register_on_exit(LPM0_bits);
}
void main(void)
{
/* Stop watchdog timer from timing out during initial start-up. */
WDTCTL = WDTPW | WDTHOLD;
/* initialize Config for the MSP430 GPIO */
GPIO_graceInit();
/* initialize Config for the MSP430 2xx family clock systems (BCS) */

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