|
Stepper motor MOSFET drive
Description
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.
Software functions
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 rotation. 0=clockwise(default),-1=anticlock.
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
interrupt routine. STEP_MODE = 1; // single step, hi-torque STEP_DIR = 0; // rotate right STEP_STEPS = 20; // 20 steps while( STEP_STEPS ); // wait until steps complete
|
Schematic

|
| |
|
|
|
|