problem in starting Timer1 in MSP430

Discussion in 'The Projects Forum' started by ep.hobbyiest, Oct 21, 2014.

  1. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    I m using msp430g2553 launch pad and configuring timer. but facing problem.
    Here is my code
    Code (Text):
    1.  
    2. #include <msp430g2553.h>
    3.  
    4.  
    5. void main(void) {
    6.     WDTCTL = WDTPW + WDTHOLD;    // disable watchdog
    7.  
    8.     P1OUT = 0;
    9.     P1DIR |= 0x01;    //led
    10.  
    11.     TACCR0 = 10000;  
    12.     TACCTL0 = CCIE;        // Enable interrupts for CCR0.
    13.     TACTL = TASSEL_2 + ID_3 + MC_1 + TACLR;  // SMCLK, div 8, up mode,
    14.                                             // clear timer
    15.  
    16.     _enable_interrupt();
    17.  
    18.     for(;;) {    // Do nothing while waiting for interrupts.  This would be an
    19.     }            // an ideal place to use low power modes!
    20. } // main
    21.  
    22.  
    23. /*  Interrupt Service Routines  */
    24. #pragma vector = TIMERA0_VECTOR
    25. __interrupt void CCR0_ISR(void) {
    26.         P1OUT ^= 0x01;
    27.     }
    28. // CCR0_ISR
     
  2. tindel

    Active Member

    Sep 16, 2012
    568
    193
    _enable_interrupt(); doesn't seem right to me... I think you have to enable the interrupt register for Timer A0 instead.

    it does look like _enable_interrupt() is a valid function call from intrinsic.h, but I can't find the code that describes the function. Are you getting a linker error or what? I would bet you compile just fine and your linker is failing, No?
     
Loading...