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.

2 Channel PWM with MSP430G2452

Other Parts Discussed in Thread: MSP430G2452

I'm working on an application which requires two pwm channels. After failing to impliment them in my main code I've written up a simple program to light two led's with different signals to debug the problem, but I'm still not getting the results I want. Here's my code:

 

#include  <msp430g2452.h>

 

void main(void)

{

   WDTCTL = WDTPW + WDTHOLD; // Kill WDT

   P1DIR |= BIT2+BIT4;

   P1SEL |= BIT2+BIT4;

   TA0CCR0 = 128;        // PWM period

   TA0CCTL1 = OUTMOD_7;

   TA0CCR1 = 20;         // Changes in this value are reflected on the LED

   TA0CCTL2 = OUTMOD_7; 

   TA0CCR2 = 80;  //Changes in this value make no difference with respect to LED brightness 

   TA0CTL = TASSEL_1 + MC_1 + TACLR;  

 

   __bis_SR_register(LPM0_bits); //LPM 0

 

   while(1);

}

 

The led attached to pin 1.4 does light, but only to an arbitrary value not related to the value of TA0CCR2. Any ideas?

**Attention** This is a public forum