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.

MSP430F5524: Proper procedure to turn off and restart timer

Part Number: MSP430F5524

Hi

I am generating a PWM to turn on a fan. Here is the code

TA2CCR0 = 1000; // PWM Period
TA2CCTL1 = OUTMOD_7; // CCR1 reset/set
TA2CCR1 = 900; //384; // CCR1 PWM duty cycle
TA2CCTL2 = OUTMOD_7; // CCR2 reset/set
TA2CCR2 = 900; //128 // CCR2 PWM duty cycle
TA2CTL = TASSEL_2 + MC_1 + TACLR; // SMCLK, up mode, clear TAR

I want to be able to turn it on and off. It should restart generating the same PWM with the same duty cycle. Here is the code for turn-off.

//Are these lines needed?

//TA2CCR0 = 0;                                                                                                                                                                                                                                                          //TA2CCTL1 = 0;

//TA2CCR1 = 0;
//TA2CCTL2 = 0;
//TA2CCR2 = 0;
//TA2CTL = TASSEL_2 + MC_1 + TACLR; 

TA2CTL &= ~(MC_1);  //Is only this line sufficient?

Is it enough if I just toggle and set MC_1 or should I set the other registers(Capture compare registers, TACTL etc.) to 0 and re-initialise them?

Thanks

Abhishek