ATMEL stepper motor drive algorithm