This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: Timer not working

Part Number: MSP430G2553

Hi all,

          I recently started working with my MSP430G2553 microcontroller by programming it using BSL. All the codes upload and work without any problem except the codes that make use of timers. 

          Programs using timer are getting compiled and uploaded successfully, but the MCU does nothing. I added few debug statements (using an LED at the output) to figure out the problem and found out that the OFIFG flag always remains 1.

//A simple blink sketch

void register_settings_for_GPIO()
{
    P1DIR |= BIT7;                            
    P1OUT &= ~BIT7;                         
}

void register_settings_for_TIMER0()
{
    CCTL0 = CCIE;                         
    TACTL = TASSEL_1 + MC_1;            
    CCR0 =  32768;                     
}

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;            
  unsigned int i;

  do{
         IFG1 &= ~OFIFG;                 
         for (i = 50000; i; i--);           
    } while (IFG1 & OFIFG);         

  register_settings_for_TIMER0();
  register_settings_for_GPIO();
  _BIS_SR(LPM3_bits + GIE);  
}

#pragma vector= TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
    P1OUT |= BIT7;                     
    __delay_cycles(200);
    P1OUT &=~ BIT7;
}



What could be the possible error here?

Thanks in advance.

**Attention** This is a public forum