title: MSP430G2553 Timer Intervals
body: <p>After reading the text about five times and googling I've decided to reach out for help. I'm currently in the process of using Timer_A interrupt to turn on/off two LEDS in intervals of 1 second/10 seconds/1 minute one at a time. The default program will turn on/off the LEDS every second but I cannot find a way to turn them off after 10 seconds and a minute. I can use __delay_cycles(xxxx) to achieve this but apparently doing so would defeat the purpose of the timer. This is my code.</p>
  
  <pre><code>#include &lt;msp430.h&gt;
  
  #define RedLED BIT0
  #define GreenLED BIT6
  
  #define RedLEDToggle (P1OUT ^= RedLED)
  #define GreenLEDToggle (P1OUT ^= GreenLED)
  
  unsigned int counter = 0;
  
  
  void main(void)
  {
      WDTCTL = WDTPW | WDTHOLD;
      //WDTCTL = WDT_MDLY_32;
  
      P1DIR = RedLED | GreenLED;
      P1OUT = RedLED | GreenLED;
  
      TACTL = TASSEL_2 | ID_3 | MC_3 | TAIE;
  
      TACCR0 = 62500;
  
      _enable_interrupts();
  
  
      LPM1;
  }
  
  #pragma vector=TIMER0_A1_VECTOR
  
  __interrupt void Timer_A(void)
  {
  
  if ( counter == 10)
  {
  switch (TAIV)
      {
      case 0x02: break;
      case 0x04: break;
      case 0x0A: RedLEDToggle | GreenLEDToggle;
          break;
      }
  }
  else
  {
  counter ++;
  }       
  }
  </code></pre>