Here is another alternative: Vary the period you increment your speed.
This examply uses PAUSE.
What would be ideal is set up a timer and add a value so that it overflows after "Incr_Time_ms". You can then use interrupts, or just poll the flag bit. increment your "Current_Val", clear the flag bit, and then add the value to set up the overflow after "Incr_Time_ms". Wash-Rinse-Repeat until "Current_Val = End_Val"Code:Incr_Time_ms = (1000 * Duration) / (End_Val - Start_Val) Current_Val = Start_Val Do Until Current_Val = End_Val PAUSE Incr_Time_ms Current_Val = Current_Val + 1 Loop




Bookmarks