Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Combined PWM with interrupt not interrupting

$
0
0

Hi All,

 

I am trying to generate a PWM output using TimerA, which I also want to trigger an interrupt at TACCR0.

There is nothing in the manual that suggests I cant do this, but for some reason the interrupt is not firing, even though PWM is working as expected.

 

Here is how I set it up, can anyone spot anything obvious?

#define PWMOUT BIT2;
P1OUT &= ~PWMOUT; // output 0 to start with
P1DIR |= PWMOUT; // set as output
P1SEL |= PWMOUT; // select timer OUT
TA0CCR0 = PWM_FREQ_CLKS - 1; TA0CCR1 = PWM_DUTY_CLKS; TA0CCTL1 |= OUTMOD_7; // setup pwm output mode 
TA0CCTL0 |= CCIE; // enable interrupt TA0CTL |= (TASSEL_2 + MC_1 + TAIE); // start timer, enable interrupts

and the ISR

#pragma vector=TIMER0_A0_VECTOR //Timer A0 CCR0.
__interrupt void PWM_Cycle(void)
{
	TA0CCR1 = PWM_DUTY_CLKS;
	Measured_COMM_PWM_Counts++;
}

Viewing all articles
Browse latest Browse all 2077

Trending Articles