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.
Tool/software: Code Composer Studio
Hi,
I would like to have PWM output on three pins P2.2, P2.3 and P2.4. I have tried following code but it is working for P2.2 only and not for P2.3 and P2.4.
Code:
P2DIR |= BIT2|BIT3|BIT4; // P2.2,P2.3,P2.4 output P2SEL |= BIT2|BIT3|BIT4; TA1CCR0 = 512-1; // PWM Period TA1CCTL1 = OUTMOD_7; // CCR1 reset/set TA1CCR1 = 384; //CCR1 PWM duty cycle TA1CTL = TASSEL_2 + MC_1; // SMCLK, up mode
Please help me to understand mistake in above code. Is it possibe to have same PWM duty cycles on three different pins as mentioned above?
Is it possible to generate different PWM duty cycles on three different pins using single timer?
Thanks,
Krunal
To get PWM on a channel, you (1) set CCTLx:OUTMOD as appropriate, and (2) CCRx=duty (in ticks).
You can do this with CCR0, but most people don't bother since you can only get 50% duty out of it. (Ref SLAU144J sec. 12.2.5.1)
Yes. (There's also TA0.2, but that isn't available as a pin on the Launchpad DIP-20 package.)
To get TA0.1, you will need to set up TA0 (TA0CTL and all them) in addition to TA1. You can use the same values, though if you need them to be synchronized (start at Exactly the same time) that can be difficult (depending on your definition of "Exactly").
**Attention** This is a public forum