项目作者: Majid-Derhambakhsh

项目描述 :
Using Stepper Motor in ARM/AVR microcontroller
高级语言: C
项目地址: git://github.com/Majid-Derhambakhsh/StepMotor.git
创建时间: 2019-07-01T02:00:01Z
项目社区:https://github.com/Majid-Derhambakhsh/StepMotor

开源协议:

下载


Banner

StepMotor Library

Using Step Motor in AVR - ARM Cortex M

Download Driver Version : StepperDriver

Version : 0.1.0

  • Type : Embedded Software.

  • Support : AVR/ARM STM32 series.

  • Program Language : C

  • Properties :

Initialization and de-initialization functions:

Operation functions:

  1. void StepMotor_WaveDriveChangeStep(int16_t number_of_step , uint16_t step_time); /* This function is for change step in wave drive mode */
  2. void StepMotor_WaveDriveChangeAngle(float angle , uint16_t step_time); /* This function is for change angle in wave drive mode */

Macros:

  1. #define _MOTOR_PORT
  2. #define _MOTOR_PIN_A
  3. #define _FULL_ANGLE
  4. #define _STEP_QUANTITY
  5. #define _STM32_HAL_DRIVER

How to use this library

The Stepper Motor library can be used as follows:

1. Add .h and source file in project.

2. Config GPIO as output in your project.

3. Config Stepper Motor in ‘STEP_MOTOR_CONFIG.h’ header, for example:

  • Options:

    1. /* --- Config Port --- */
    2. #define _MOTOR_PORT &PORTB
    3. #define _MOTOR_PIN_A 1
    4. /* --- Config Angle --- */
    5. #define _FULL_ANGLE 360.0f
    6. #define _STEP_QUANTITY 200.0f
    7. /* --- Config Driver --- */
    8. //#define _STM32_HAL_DRIVER "STM32_GPIO/STM32_GPIO.h"

4. Using operation methods, for example:

Example 1:

  1. int main(void)
  2. {
  3. while (1)
  4. {
  5. StepMotor_WaveDriveChangeStep(10, 250);
  6. _DELAY_MS(500);
  7. StepMotor_WaveDriveChangeStep(-12, 250);
  8. _DELAY_MS(500);
  9. }
  10. }

Example 2:

  1. int main(void)
  2. {
  3. while (1)
  4. {
  5. StepMotor_WaveDriveChangeStep(10, 250);
  6. _DELAY_MS(500);
  7. StepMotor_WaveDriveChangeStep(-12, 250);
  8. _DELAY_MS(500);
  9. StepMotor_WaveDriveChangeAngle(101.0, 250);
  10. _DELAY_MS(500);
  11. StepMotor_WaveDriveChangeAngle(-150.6, 250);
  12. _DELAY_MS(500);
  13. }
  14. }

Tests performed:

  • [X] Run on AVR
  • Run on STM32 Fx cores

Developer: Majid Derhambakhsh