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.

CCS/MSP430G2231: CCS/MSP430G2231:

Part Number: MSP430G2231


Tool/software: Code Composer Studio

Hello everyone;

I wrote a pwm program for led brithness.but  i want to soft stop led light after for dark.

Could you help me for led dimming and soft stop after blinking.

thank you.

#include <msp430g2231.h>

void main(void)

{

WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer

DCOCTL = CALDCO_1MHZ; //SET DCO STEP + MODULATION

BCSCTL1 = CALBC1_1MHZ; //SET RANGE

P1DIR |= BIT2; // P1.2 OUTPUT

P1SEL |= BIT2; // TA0.1 ENABLE

P1OUT |= BIT2; // P1.2 RESISTOR PULL-UP

P1REN |= BIT2; //RESISTOR ENABLE

TACCR0 = 1000; // PWM PERIOD

TACCR1 = 600; // DUTY CYCLE

TACCTL1 = OUTMOD_7; // RESET/SET

TACTL = TASSEL_2 + MC_1 ; //SMCLK, UP MODE

while(1)

{

}

 

}

**Attention** This is a public forum