Sign in

username:

password:



Not a member?

Search msp430



Search tips

Subscribe to msp430





Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | MSP430 | Timer A for PWM


Advertise Here

The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.

Timer A for PWM - sang...@yahoo.com - Aug 5 9:12:19 2009

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 )


Re: Timer A for PWM - old_cow_yellow - Aug 5 9:23:52 2009

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 )