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

Forum Post: RE: Initialization of PWM

$
0
0
[quote user="chintan patel83"] Right , i am not use Output modes 2, 3, 6, and 7 are not useful for output unit 0. so how we config for other Output mode. I set the Toggle mode but it is blinking not performing the PWM operation. So how i configure for outmode 0 for PWM generation ? [/quote] You are setting OUTMOD_7 for timer TA2.0. [quote user="chintan patel83"] void touch_led2(void) // pin49 TA2_0 { TA2CCR0 = 512 - 1; // PWM Period TA2CCTL0 = OUTMOD_7; // CCR0 reset/set <<<< Right here TA2CCR0 = 0; // CCR0 PWM duty cycle TA2CTL = TASSEL_1 | MC_1 | TACLR; // ACLK, up mode, clear TAR } [/quote] This is what you need to do: Set up your timer TA2CTL = TASSEL_1 | MC_1 | TACLR; // ACLK, up mode, clear TAR Set the PWM frequency using TA2CCR0 as you have done TA2CCR0 = 512 - 1; // PWM Period Set the up your first PWM on TA2.1 TA2CCTL1 = OUTMOD_7; // CCR1 reset/set TA2CCR1 = [DUTY CYCLE] Where 0 < [DUTY CYCLE] < TA2CCR0. And then do the same for TA2.2 TA2CCTL2 = OUTMOD_7; // CCR1 reset/set TA2CCR2 = [DUTY CYCLE] Now you have two PWM outputs that can have different duty cycle. Just set up the pin configuration for your board and your done.

Viewing all articles
Browse latest Browse all 62388

Trending Articles



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