Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: MSP430G2553 PWM accuracy issues

$
0
0
Hi, I need to produce a relatively accurate frequencies. I'm using PWM with 50% Duty Cycle. I need to produce frequencies with distance of 50 Hz in between ({3150, 3200, 3250, ..., 4150, 4200}). I'm using the following code but get 3405 Hz instead of 3205 Hz. I'm using the following testing code: #include int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT int f=3200; int t=1000000/f; P1DIR |= 0x0C; // P1.2 and P1.3 output P1SEL |= 0x0C; // P1.2 and P1.3 TA1/2 options CCR0 = t - 1; // PWM Period/2 CCTL1 = OUTMOD_6; // CCR1 toggle/set CCR1 = t/2; // CCR1 PWM duty cycle TACTL = TASSEL_2 + MC_1; // SMCLK, up-down mode __bis_SR_register(LPM0_bits); // Enter LPM0 } Any ideas? Thanks, Itay Cohen

Viewing all articles
Browse latest Browse all 62309

Trending Articles



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