EmbeddedRelated.com
Forums

Timer A Interrupt

Started by chetan loke March 1, 2005
Hello,
Basically I'm trying to generate a PWM o/p(for 1ms)
after a 20ms period using TimerA .This is my first
time programming a microcontroller...i went thru' the
code samples and wrote this code...but 
1)it wont compile...am i missing something?
2)looking at the code will i be able to achieve the
above PWM o/p for 1ms after a 20ms period?

Thnks


#include  "msp430x11x1.h"
#include  "timera.h"

void main(void)
{ 
  WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
  
  P1OUT = 0;
  P1SEL = 0X04;  // P1.2
  P1DIR = 0Xff;   
  CCTL1 = OUTMOD_7;
  TACTL = TASSEL_1 + MC_1 + TAIE;       // ACLK,
upmode, interrupt
  CCR0 = 640;
  _BIS_SR(LPM0_bits + GIE);             // Enter LPM0
w/ interrupt
   

}

#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A(void)
{
 switch( TAIV )
 {
   case  2: break;                      
   case  4: break;                      
   case 10: CCR1 = 32;              // overflow
            break;
 }
}


$ make
msp430-gcc -mmcu=msp430x1611 -O2 -Wall -g   -c -o
main.o main.c
main.c:23: warning: ignoring #pragma vector
main.c:24: syntax error before "void"
make: *** [main.o] Error 1








		
__________________________________ 
 




Beginning Microcontrollers with the MSP430