Part Number: MSP430F6779A
Tool/software:
Hi I am trying to make PWM of 1KHZ on Timer 0 channel 0 the period is fixed 25165 as per my clock at 25MHz. I am able to generate fixed PWM of 500Hz with 50 percent duty cycle the initialization code is given below.
can not change the timer period as it is being used for other peripheral
timer initialization:-
.
TA0CCR0 = 25165; // CCR0 for PWM Period TA0CCTL2 = OUTMOD_7; // CCR2 reset/set TA0CCTL0 |= CCIE; // To generate interrupt on CCR0 TA0CTL = TASSEL_2 | MC_1 | TACLR; // SMCLK, up mode - Up to CCR0, clear TAR
the given bellow code is used for generating PWM for 500 hz 50% duty cycle.
TA0CCTL0 = OUTMOD_4;
changing the mode gives me 0%,1%,99% and 100% duty.
but not able to generate 1Khz of 50% duty.
Approach 2:-
using timer to generate interrupt at 2Khz and toggling gpio at interrupt but this is giving variation in duty and frequencyas i am using EMDC library and generating Sigma Delta interrupts which might be creating interrupt latency.