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 #129 background imageLoading...
Page #129 background image
129
/*
* TA1CCTL0, Capture/Compare Control Register 0
*
* CM_1 -- Rising Edge
* CCIS_0 -- CCIxA
* ~SCS -- Asynchronous Capture
* ~SCCI -- Latched capture signal (read)
* ~CAP -- Compare mode
* OUTMOD_1 -- PWM output mode: 1 - Set
*
* Note: ~<BIT> indicates that <BIT> has value zero
*/
TA1CCTL0 = CM_1 | CCIS_0 | OUTMOD_1;
/*
* TA1CCTL1, Capture/Compare Control Register 1
*
* CM_1 -- Rising Edge
* CCIS_0 -- CCIxA
* SCS -- Sychronous Capture
* ~SCCI -- Latched capture signal (read)
* CAP -- Capture mode
* OUTMOD_0 -- PWM output mode: 0 - OUT bit value
*
* Note: ~SCCI indicates that SCCI has value zero
*/
TA1CCTL1 = CM_1 | CCIS_0 | SCS | CAP | OUTMOD_0 | CCIE;
/*
* TA1CTL, Timer_A3 Control Register
*
* TASSEL_2 -- SMCLK
* ID_0 -- Divider - /1
* MC_2 -- Continuous Mode
*/
TA1CTL = TASSEL_2 | ID_0 | MC_2;
In the timer ISR, we need to check first what caused the interrupt. If it was due to a rising edge capture
then we have to take note of current time count in TA1CCR1 since we are using input capture channel
1 of Timer1_A3. Two such time counts are needed to find out the time difference between two
adjacent rising edges. This gives us the time period of the captured incoming waveform. However, we
are not stopping input capture or the timer even after two successive capture events. This is because
we are continuous monitoring the incoming waveform.
#pragma vector=TIMER1_A1_VECTOR
__interrupt void TIMER1_A1_ISR_HOOK(void)
{
if(TA1IV == TA1IV_TACCR1)
{
end_time = TA1CCR1;
pulse_ticks = (end_time - start_time);
start_time = end_time;
TA1CCTL1 &= ~CCIFG;
}
}

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