Quote Originally Posted by Jerson View Post
If you do not intend running any tasks in the background while doing the acc/deceleration, the following idea may work

Code:
Rate = ((Max-Min) *1000)/ Time   ' the 1000 is since I assume a mS time base
Here the Time variable is specified in seconds.

Now, using a 1mS time base, you can do this

Code:
for x = 0 to rate
   Output = Output + Rate  ' increase the output by a fraction we calculated
   pause 1           ' this is the 1mS time base I talked of
next
Rate could be -ve to decelerate.
Hello,

Thanks for your idea, I will try this into my program, but unfortunately I think that the "pause" command will make problems, because a lot of things are running in the background during this acc/deceleration (like the sine PWM generation high priority interrupt, using timer 1).

I think use this in a low frequency and low priority interrupt (with timer 0), maybe the "pause" command will be useless?

Note I'm using Darrel Taylor's interrupts.