Stepper motor driver, increment/decrement the position and outputs the correct signals to stepper motor.
Definition in file sm_driver.c.
#include <ioavr.h>
#include "global.h"
#include "sm_driver.h"
Include dependency graph for sm_driver.c:
Go to the source code of this file.
Defines | |
#define | BIT_A1 3 |
#define | BIT_A2 2 |
#define | BIT_B1 1 |
#define | BIT_B2 0 |
Functions | |
void | sm_driver_Init_IO (void) |
Init of io-pins for stepper motor. | |
unsigned char | sm_driver_StepCounter (signed char inc) |
Move the stepper motor one step. | |
void | sm_driver_StepOutput (unsigned char pos) |
Convert the stepcounter value to signals for the stepper motor. | |
Variables | |
int | stepPosition = 0 |
Position of stepper motor. | |
__flash unsigned char | steptab [] |
Table with control signals for stepper motor. |
|
Definition at line 29 of file sm_driver.c. |
|
Definition at line 30 of file sm_driver.c. |
|
Definition at line 31 of file sm_driver.c. |
|
Definition at line 32 of file sm_driver.c. |
|
Init of io-pins for stepper motor.
Definition at line 49 of file sm_driver.c. References A1, A2, B1, B2, SM_DRIVE, and SM_PORT. Referenced by Init().
|
|
Move the stepper motor one step. Makes the stepcounter inc/dec one value and outputs this to the steppermotor. This function works like a stepper motor controller, a call to the function is the stepping pulse, and parameter 'inc' is the direction signal.
Definition at line 66 of file sm_driver.c. References CCW, sm_driver_StepOutput(), and stepPosition. Referenced by speed_cntr_TIMER1_COMPA_interrupt().
Here is the call graph for this function: ![]() |
|
Convert the stepcounter value to signals for the stepper motor. Uses the stepcounter value as index in steptab to get correct steppermotor control signals. Converts these signals to work with the stepper driver hardware.
Definition at line 108 of file sm_driver.c. References SM_PORT, and steptab. Referenced by Init(), and sm_driver_StepCounter().
|
|
Position of stepper motor.
Definition at line 45 of file sm_driver.c. Referenced by main(), and sm_driver_StepCounter(). |
|
Initial value: Table with control signals for stepper motor.
Definition at line 35 of file sm_driver.c. Referenced by sm_driver_StepOutput(). |