Files
new_f_3/User/bsp/inc/bsp_step_moto.h
2026-04-16 17:17:53 +08:00

52 lines
1.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//------------------------------------------------------------------------------
// 模块名称:步进电机脉冲驱动模块
// 文件名称bsp_step_moto
// 版本名称V1.0
// 文件说明:头文件
// 日期时间2018年8月23日20点37分
// 文件作者Jackie Chan
// 修改记录:
// 版本号 日期 作者 说明
// V1.0 2018.08.23 J.C 正式发布
//
// 公司名称:多场低温科技有限公司
//
//------------------------------------------------------------------------------
#ifndef _BSP_STEMP_MOTO_H
#define _BSP_STEMP_MOTO_H
#include <stdint.h>
typedef struct
{
uint8_t Dir; /* 0 表示正转 1 表示反转 */
uint32_t StepFreq; /* 步进频率 */
uint32_t StepCount; /* 剩余步数 */
uint32_t AllStep; /* 一次转动命令所要走的脉冲总数 */
uint32_t CurrentStep; /* 已经走过的步数 */
uint32_t DispStep; /* 显示走过的步数,零点搜索时候不计数 */
uint8_t Running; /* 1表示正在旋转 0 表示停机 */
uint8_t Pos; /* 线圈通电的相序0-7 */
int64_t pv_pulse; // 当前的脉冲值
int64_t sv_pulse; // 电脑端的设定脉冲值
int64_t prev_pv_pulse;// 上一次脉冲值,用于检测过零点
int32_t zero_counter; // 过零点步数计数器,每走一步+1或-1到STEP_PER_LAP翻转PA6
} MOTO_T;
extern MOTO_T g_tMoto;
void bsp_InitStepMoto(void);
void MOTO_Start(uint32_t _speed, uint8_t _dir, int32_t _stpes);
void MOTO_ZorePos(void);
void MOTO_Stop(void);
void MOTO_Pause(void);
void MOTO_ShangeSpeed(uint32_t _speed);
uint32_t MOTO_RoudToStep(void);
extern MOTO_T g_tMoto;
#endif
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/