Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21934

Fluctuation in generating four 20kHz PWM signal at 8Mhz clock

$
0
0

Hi,

I am generating 4 PWM signals of 50% dutycycle and 20kHz frequency using timer A0 and 8Mhz clock to the timer module. But I am getting fluctuation of around 120Hz periodicaly.

I am not able to identify the reason of it. Can any one please suggest a sollution to this problem? Why this is happening?

Below is the part of my code:-

intmain(void)

{

/* Set UCS clock system */

vUcsInitClock(); //ACLK is 8Mhz

P1DIR |= BIT2+BIT3+BIT4+BIT5; // P1.2 and P1.3 output

P1SEL |= BIT2+BIT3+BIT4+BIT5; // P1.2 and P1.3 options select

TA0CCR0 = 399; // PWM Period

TA0CCTL1 = OUTMOD_7; // CCR1 reset/set

TA0CCR1 = 199; // CCR1 PWM duty cycle

TA0CCTL2 = OUTMOD_7; // CCR2 reset/set

TA0CCR2 = 199; // CCR2 PWM duty cycle

TA0CCTL3 = OUTMOD_7; // CCR1 reset/set

TA0CCR3 = 199; // CCR1 PWM duty cycle

TA0CCTL4 = OUTMOD_7; // CCR2 reset/set

TA0CCR4 = 199; // CCR2 PWM duty cycle

TA0CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, up mode, clear TAR

}


Viewing all articles
Browse latest Browse all 21934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>