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.

MSP430F5529 PWM signal on an LED on the Launchpad

Other Parts Discussed in Thread: MSP430F5529

Hello, 

I was wondering if I can create PWM signals to light up LED2 on P4.7 on the launchpad based on the duty cycle. Here is the code I've been using, but running the code the LED does not turn on. I really appreciate your help.

#include <msp430F5529.h> 
 // Define registers
#define LED_PDIR P4DIR
#define LED_POUT P4OUT
#define LED_PIN  BIT7
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
LED_PDIR |= LED_PIN; //set P4.7 as output
P4SEL |= LED_PIN;       //set P4.7 to pulse width modulation
LED_POUT &= ~LED_PIN;   //set p1.0 low
ConfigTimerA(1000 - 1);
while(1)
{
_bis_SR_register(LPM0_bits + GIE); //LPM3 - Global Interrupt Enabled
}
}
void ConfigTimerA(unsigned int delaycycles)
{
TA0CCTL0 |= CCIE;           //TA0 is enabled
TA0CCR0 = delaycycles;   //pwm period
TA0CCTL1 = OUTMOD_7;
TA0CCR1 = 250;
TA0CTL |= TASSEL_2;           //ACLK
TA0CTL |= MC_1 + TACLR;   //Up Mode
}
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER_A0(void)
{
LED_POUT ^= LED_PIN;
}

Thank you very much

**Attention** This is a public forum