Stepper motor MOSFET drive
Stepper motor driver for uniphase stepper motors. Three
stepper modes: half, full hi-torque, full lo-torque.
Call SETP_DO() at regular intervals, set STEP_STEPS
to move stepper motor.
STEP_DO() : stepper motor drive state machine. Call at
regular intervals e.g from timer tick interrupt service
routine every 1ms.
STEP_STEPS : 16bit variable for setting the number
steps the stepper motor is to move by, also indicates
the number of steps to complete. The motor can be
stopped at anytime by setting this variable to zero.
STEP_DIR : 8bit variable for setting the direction of
STEP_SPEEDT : 8bit variable for setting the speed of the
stepper motor by setting the length of time in ticks between
steps (default 100). Eg if STEP_DO() is called every 1ms, a
value of 100 would cause a step change every 100ms.
STEP_MODE : 0=half step(default), 1=full step
hi torque, 2=full step low torque.
Example: Move clockwise 20 steps. This example assumes
STEP_DO() is called at regular intervals by a timer
STEP_MODE = 1; // single step, hi-torque
STEP_DIR = 0; // rotate right
STEP_STEPS = 20; // 20 steps
while( STEP_STEPS ); // wait until steps complete