/PIC Stuff/PICX_16F1825_Stepper_Driver/STEPPER.c |
---|
0,0 → 1,40 |
#include "defines.h" |
#include "STEPPER.h" |
void STEPPER_Set_Microstep(STEPPER_MICROSTEP step) { |
#ifdef DVR8825 |
if (step == STEP_1_1) { |
M0_LAT = 0; |
M1_LAT = 0; |
M2_LAT = 0; |
} else if (step == STEP_1_2) { |
M0_LAT = 1; |
M1_LAT = 0; |
M2_LAT = 0; |
} else if (step == STEP_1_4) { |
M0_LAT = 0; |
M1_LAT = 1; |
M2_LAT = 0; |
} else if (step == STEP_1_8) { |
M0_LAT = 1; |
M1_LAT = 1; |
M2_LAT = 0; |
} else if (step == STEP_1_16) { |
M0_LAT = 0; |
M1_LAT = 0; |
M2_LAT = 1; |
} else if (step == STEP_1_32) { |
M0_LAT = 1; |
M1_LAT = 0; |
M2_LAT = 1; |
} |
#endif |
} |
void STEPPER_Set_Direction(char dir) { |
if (dir) { |
DIR_LAT = 1; |
} else { |
DIR_LAT = 0; |
} |
} |