I am using MSP430F4270,
and i would like to have PWM signal on TA0 pin. it can produce PWM signal,
but the problem is if I change CCR0 or CCR1 value. the duty cycle or the period won't
change.
can someone give me suggestion please..
below is the code
#include
void main(void)
{
WDTCTL = WDTPW +WDTHOLD; // Stop WDT
P1DIR |= 0x01; // P1.0 output
P1SEL |= 0x01; // P1.0 TA0 option
CCR0 = 512-1; // PWM Period
CCTL0 = OUTMOD_7; // CCR1 reset/set
CCR1 = 384; // CCR1 PWM duty cycle
TACTL = TASSEL_1 + MC_1; // ACLK, up mode
}
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
You set up CC0 in mode 7, thus TA0-out taggles at half-period CCR0+1 with 50-50 duty
cycle. Your CCR1 does not do any thing for you.
You need to use CC1 (or any CCx other than CC0) to generate PWM, and use CC0 to control
the half-period. See User's Manual. Do not just paraphase examples without understanding
it.
--- In m...@yahoogroups.com, sangadot@... wrote:
>
> I am using MSP430F4270,
>
> and i would like to have PWM signal on TA0 pin. it can produce PWM signal,
>
> but the problem is if I change CCR0 or CCR1 value. the duty cycle or the period won't
change.
>
> can someone give me suggestion please..
>
> below is the code
>
> #include
void main(void)
> {
> WDTCTL = WDTPW +WDTHOLD; // Stop WDT
> P1DIR |= 0x01; // P1.0 output
> P1SEL |= 0x01; // P1.0 TA0 option
> CCR0 = 512-1; // PWM Period
> CCTL0 = OUTMOD_7; // CCR1 reset/set
> CCR1 = 384; // CCR1 PWM duty cycle
> TACTL = TASSEL_1 + MC_1; // ACLK, up mode
>
> }
>
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )