Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sun May 06, 2012 8:28 am |
|
|
This is really just basic programming.
Instead of structuring your code as:
do what you want forever
Structure your code as:
do what you want until a time has passed
then sit and wait.
How you work out that the 'time has passed', would depend on how your stepper motor code is written. For instance, if it is a loop controlling a pulse train to a stepper, with a pulse being sent every 1mSec for example, then you could just loop for 20000 times. If however it doesn't have a fundamental 'time', then you can just use one of the timers to generate a clock, and wait till this shows the time has passed, or add an external chip, with a programmable 'alarm', and use this as the signal.
Best Wishes |
|