Reply by Karl Olsen January 17, 20062006-01-17
---- Original Message ----
From: "bobtransformer" <bgudgel@bgud...>
To: <lpc2000@lpc2...>
Sent: Tuesday, January 17, 2006 9:12 PM
Subject: [lpc2000] Re: PWM, change frequency during runtime

> I need to look this up and find out how it works also... With Atmel
> AVR parts at least, the new PWM value is not accepted as the compare
> value until the current PWM cycle completes. i.e. it is a syhcronous
> load which is the way I would expect it to work. Especially since you
> may be altering several different PWM channels at the same time.
>
> I really like that method and ~hope~ that the LPC parts are similar.

When PWM Enable (PWMTCR bit 3) is set, changing the MRx registers takes
effect at the next MR0 match (end of PWM cycle) because of the MRx shadow
registers. When that bit is clear, changing the MRx registers takes effect
immediately, in the middle of the cycle.

There is no such shadow register associated with PWMPR indicated on the PWM
block diagram, so changing PWMPR most likely takes effect immediately, in
the middle of the PWM cycle, regardless of PWM Enable.

Karl Olsen
> -- In lpc2000@lpc2..., "Joel Winarske" <joelw@i...> wrote:
>>
>>> The Question is:
>>> When i change the PWMPR to another value when the PWM is enabled, at
>>> which state/time is the new PWMPR active ?
>>
>> An educated guess:
>> It should happen on edge of PWMPC increment, which is driven by
>> pclk edge. So next PWMPC increment edge after writing reg.




An Engineer's Guide to the LPC2100 Series

Reply by bobtransformer January 17, 20062006-01-17
I need to look this up and find out how it works also... With Atmel
AVR parts at least, the new PWM value is not accepted as the compare
value until the current PWM cycle completes. i.e. it is a syhcronous
load which is the way I would expect it to work. Especially since you
may be altering several different PWM channels at the same time.

I really like that method and ~hope~ that the LPC parts are similar.

boB
K7IQ
Everett, WA

-- In lpc2000@lpc2..., "Joel Winarske" <joelw@i...> wrote:
>
> > The Question is:
> > When i change the PWMPR to another value when the PWM is enabled,
at
> > which state/time is the new PWMPR active ?
>
> An educated guess:
> It should happen on edge of PWMPC increment, which is driven by
pclk
edge.
> So next PWMPC increment edge after writing reg. > Joel
>


Reply by Joel Winarske January 17, 20062006-01-17
> The Question is:
> When i change the PWMPR to another value when the PWM is enabled, at
> which state/time is the new PWMPR active ?

An educated guess:
It should happen on edge of PWMPC increment, which is driven by pclk edge.
So next PWMPC increment edge after writing reg. Joel


Reply by tomfeller69 January 17, 20062006-01-17
Hi

I have a question about the PWMPR Register (frequency, LPC2292).

To generate a ramp for an stepper motor, i want change the frequency
during the runtime of the PWM.

The Question is:
When i change the PWMPR to another value when the PWM is enabled, at
which state/time is the new PWMPR active ?

Thanks & best regards

Thomas