Timer Input Capture Mode Interrupt not Triggered

284 views
Skip to first unread message

seanasl

unread,
Sep 24, 2012, 5:53:21 AM9/24/12
to ti-lau...@googlegroups.com
Dear All ,

I am rather new to MSP430. I have the following code to capture an input signal from a sensor (using function generator for testing now). However , the interrupt is not triggered upon the function generator power up. I am using P1.0 to connect to a led while P1.1(TA0) used as capture input.

Any comments or mistake i have made ?? Thank you.

=============================================================
#include  <msp430x14x.h>

unsigned int new_cap=0;

void main(void)
{
 volatile unsigned int i;
 WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
 for (i=0; i<5000; i++);                   // Delay for crystal stabilization
 
 P1DIR = 0x01;                             // Set P1.0 out,1.1 input dir
   
 P1SEL = 0x02;                             // Set P1.1 to TA0  
 CCTL0 = CM_1 + CCIS_0 + CAP + CCIE; // Rising edge + CCI0A (P1.1)
                                            // + Capture Mode + Interrupt
  
 TACTL = TASSEL_3 + MC_1;                  // SMCLK + Continuous Mode
 _BIS_SR(GIE);                 // LPM0 + Enable global ints
while(1){
for (i=0; i<50000; i++)
  P1OUT &= ~0x01;                           // LED off
  for (i=0; i<50000; i++)
  P1OUT |= 0x01;
}
    _BIS_SR(LPM0_bits + GIE);                 // LPM0 + Enable global ints
  
}

#pragma vector=TIMERA0_VECTOR
__interrupt void TimerA0(void)
{
   new_cap = TACCR0;
}

LaunchRed

unread,
Sep 26, 2012, 5:55:18 PM9/26/12
to ti-lau...@googlegroups.com
TA0 is not capture input. TA0 is output.
Search in Datasheet specific device, for inputs, for example:
In case msp430g2553:


.
Reply all
Reply to author
Forward
0 new messages