dwell time algorithm for stepper motor