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.
Variable Frequency - Thiago Alberto - Aug 12 9:13:15 2009
Hi
I have the following problem:
I need to control a step motor whose driver is controlled by frequency.
Higher frenquency higher velocity. I only have frequeny and direction inputs
on this driver.
I've read that is not recommended change Timer CCR0 during its operation. Is
that really truth? Because that is a BIG step motor, so i need to make
velocity comes from 0 to Vmax suavely.
Thanks.
Thiago Alberto
[Non-text portions of this message have been removed]
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.
(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Variable Frequency - old_cow_yellow - Aug 12 10:46:52 2009
There are many different ways to generate variable frequency with Timer.
I assume that you are using the "up mode" and "toggle" the output pin. If that is the
case, it is safe to increase the CCR0 setting. But to decrease CCR0, you have to do it
when TAR is smaller than the new CCR0 setting. Otherwise the next half cycle of the output
will be extremely long. Thus you you should do that in the TimerA0 ISR and make sure that
the interrupt latency is short enough to ensure that TAR will be smaller than your new
CCR0.
Example: CCR0 was 99, half cycle of output was 100. You want to change CCR0 to 49 so the
half cycle of output becomes 50. If you change CCR0 when TAR is 30, everything will be
fine. But if the CCR0 is changed to 49 while TAR is 70, the next half cycle of the output
will be 65536+50. (After that one, the subsequent ones will be 50.)
--- In m...@yahoogroups.com, Thiago Alberto
wrote:
>
> Hi
> I have the following problem:
>
> I need to control a step motor whose driver is controlled by frequency.
> Higher frenquency higher velocity. I only have frequeny and direction inputs
> on this driver.
>
> I've read that is not recommended change Timer CCR0 during its operation. Is
> that really truth? Because that is a BIG step motor, so i need to make
> velocity comes from 0 to Vmax suavely.
>
> Thanks.
>
> Thiago Alberto
> [Non-text portions of this message have been removed]
>
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: Re: Variable Frequency - Thiago Alberto - Aug 12 12:06:10 2009
Thanks
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: Variable Frequency - Stuart_Rubin - Aug 12 12:46:56 2009
I would guess that the time it takes to turn off the timer, make the change, and turn it
back on would still be much shorter than the frequency of the clock you're generating.
You might observe a small phase shift, but I doubt your motor would care.
It would be an easy experiment:
Start the timer at the 1st freq
stop the timer
change the freq
restart the timer
Observe
Stuart
--- In m...@yahoogroups.com, Thiago Alberto
wrote:
>
> Hi
> I have the following problem:
>
> I need to control a step motor whose driver is controlled by frequency.
> Higher frenquency higher velocity. I only have frequeny and direction inputs
> on this driver.
>
> I've read that is not recommended change Timer CCR0 during its operation. Is
> that really truth? Because that is a BIG step motor, so i need to make
> velocity comes from 0 to Vmax suavely.
>
> Thanks.
>
> Thiago Alberto
> [Non-text portions of this message have been removed]
>
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: Variable Frequency - tintronic - Aug 12 15:05:55 2009
Or you migh choose an MSP with TimerB and use that to generate the frequency. On TimerB,
as opposed to TimerA, you can configure when the value written in the TBCCR0 register will
be (automatically) transferred to the TBCL0 (invisible) register. TBCL0 is the actual
register that is compared to generate the frequency in up mode. That way, you can forget
about the CCR0 updating issue entirely.
--- In m...@yahoogroups.com, "old_cow_yellow"
wrote:
>
> There are many different ways to generate variable frequency with Timer.
>
> I assume that you are using the "up mode" and "toggle" the output pin. If that is the
case, it is safe to increase the CCR0 setting. But to decrease CCR0, you have to do it
when TAR is smaller than the new CCR0 setting. Otherwise the next half cycle of the output
will be extremely long. Thus you you should do that in the TimerA0 ISR and make sure that
the interrupt latency is short enough to ensure that TAR will be smaller than your new
CCR0.
>
> Example: CCR0 was 99, half cycle of output was 100. You want to change CCR0 to 49 so the
half cycle of output becomes 50. If you change CCR0 when TAR is 30, everything will be
fine. But if the CCR0 is changed to 49 while TAR is 70, the next half cycle of the output
will be 65536+50. (After that one, the subsequent ones will be 50.)
>
> --- In m...@yahoogroups.com, Thiago Alberto wrote:
> >
> > Hi
> > I have the following problem:
> >
> > I need to control a step motor whose driver is controlled by frequency.
> > Higher frenquency higher velocity. I only have frequeny and direction inputs
> > on this driver.
> >
> > I've read that is not recommended change Timer CCR0 during its operation. Is
> > that really truth? Because that is a BIG step motor, so i need to make
> > velocity comes from 0 to Vmax suavely.
> >
> > Thanks.
> >
> > Thiago Alberto
> >
> >
> > [Non-text portions of this message have been removed]
>
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: Variable Frequency - tintronic - Aug 12 15:33:20 2009
Stuart,
> I would guess that the time it takes to turn off the timer, make
> the change, and turn it back on would still be much shorter than
> the frequency of the clock you're generating. You might observe a
> small phase shift, but I doubt your motor would care.
Without knowing a lot more about the system I wouldn't dare making that assumption,
disesteeming what you called the phase shift, as what is in fact happening is that you'd
be slowing the frequency for one cycle just before increasing it, which might be harmful
for his 'big' stepper motor, to the motor driver or to what the motor is moving, as it
will be breaking it before accelerating it. It will greatly depend on how the driver uses
the frequency to energise the stepper motor coils. The system inertia might work for or
against you and should not be overlooked.
Anyway, stopping the Timer, changing CCR0 and then letting the timer continue to count
doesn't solve the TACCR0 modification issue as explained by OCY.
Regards,
Michael K.
--- In m...@yahoogroups.com, "Stuart_Rubin"
wrote:
>
> I would guess that the time it takes to turn off the timer, make the change, and turn it
back on would still be much shorter than the frequency of the clock you're generating.
You might observe a small phase shift, but I doubt your motor would care.
>
> It would be an easy experiment:
> Start the timer at the 1st freq
> stop the timer
> change the freq
> restart the timer
> Observe
>
> Stuart
>
> --- In m...@yahoogroups.com, Thiago Alberto wrote:
> >
> > Hi
> > I have the following problem:
> >
> > I need to control a step motor whose driver is controlled by frequency.
> > Higher frenquency higher velocity. I only have frequeny and direction inputs
> > on this driver.
> >
> > I've read that is not recommended change Timer CCR0 during its operation. Is
> > that really truth? Because that is a BIG step motor, so i need to make
> > velocity comes from 0 to Vmax suavely.
> >
> > Thanks.
> >
> > Thiago Alberto
> >
> >
> > [Non-text portions of this message have been removed]
>
------------------------------------

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