105 lines
2.8 KiB
C
105 lines
2.8 KiB
C
//-------------------------------------------------------------------------------
|
|
// File Name: sewhead.h
|
|
// Brief:
|
|
// Version: 1.0.0
|
|
// Create Date: 2024/10/11
|
|
// Create by: W.X
|
|
// Copyright:
|
|
// TIANJIN GETONAGAIN TECHNOLOGY CO., LIMITED
|
|
// All rights reserved.
|
|
//
|
|
// Modify by: W.X
|
|
// Modify Date: 2024/10/17
|
|
//-------------------------------------------------------------------------------
|
|
|
|
|
|
#ifndef APP_SEWHEAD_H_
|
|
#define APP_SEWHEAD_H_
|
|
|
|
#include "config.h"
|
|
#if (BOARD_USE_FOR == SEW_HEAD)
|
|
|
|
#define EN_FALG 0x55AA
|
|
// MODBUS电机通讯指令
|
|
#define MOTO_CTRL_CMD 9216 // 电机动作
|
|
#define MOTO_CMD_RST 0x0000 // 命令复位
|
|
#define MOTO_TO_ZERO 0x0001 // 归零
|
|
#define MOTO_SET_ZERO 0x0100 // 当前位置设置零位
|
|
#define MOTO_DIS 0x0400 // 去使能
|
|
#define MOTO_EN 0x0800 // 使能
|
|
#define MOTO_RESET 0x2000 // 重启
|
|
|
|
#define MOTO_CTRL_TOPOS 9218 // 电机去绝对位置
|
|
#define PFOOT_HIGH_POS 1
|
|
#define PFOOT_LOW_POS 2
|
|
#define PFOOT_BACK_POS 4
|
|
|
|
#define MOTO_CTRL_TOZPOS 9473 // 电机去坐标位置
|
|
|
|
#define MOTO_PARA_ZERO 8225 // 设定回零方式
|
|
#define MOTO_TZ_EVAL 0 // 回设定位置
|
|
#define MOTO_TZ_NLMT 1 // 回反向机械限位
|
|
|
|
#define MOTO_PARA_POS0 8320 // 设定位置0坐标
|
|
#define MOTO_PARA_POS1 8321 // 设定位置1坐标
|
|
#define MOTO_PARA_POS2 8322 // 设定位置2坐标
|
|
#define MOTO_PARA_POS3 8323 // 设定位置3坐标
|
|
|
|
#define SetElasticMotoMode SetSTM32Moto1Mode
|
|
#define GetElasticMotoState GetSTM32Moto1State
|
|
#define ElasticMotoStart STM32Moto1Start
|
|
#define ElasticMotoEnSta GetMoto1EnStatus
|
|
#define ElasticMotoEnOn SetMoto1EnOn
|
|
#define GetElasticMotoRealPos GetSTM32Moto1RealPos
|
|
#define SetElasticMotoRealPos SetSTM32Moto1RealPos
|
|
|
|
#define ADVAL_BASE 1635 // ADC基础值
|
|
#define PINEL_BASE 0 // ADC最小值
|
|
#define TAUTL_BASE 4000 // ADC最大值
|
|
#define ERROR_RANGE 10 //ADC误差范围
|
|
|
|
#define MOVE 33000 //电机位移量
|
|
|
|
#define FOOT_PULS_CL 600
|
|
#define FOOT_MAX_LEN 40
|
|
// 编码器脉冲触发方式
|
|
|
|
#define TRG_ECD_AP 1 // AP 触发
|
|
#define TRG_ECD_BP 2 // BP 触发
|
|
#define TRG_ECD_AB2 3 // AB 触发, 2倍脉冲
|
|
#define TRG_ECD_AB4 4 // AB 触发, 4倍脉冲
|
|
|
|
#define TRIGGER_TYPE TRG_ECD_AP
|
|
|
|
#if (TRIGGER_TYPE == TRG_ECD_AP || TRIGGER_TYPE == TRG_ECD_BP)
|
|
#define ENCODER_PNUM 1000
|
|
#elif (TRIGGER_TYPE == TRG_ECD_AB2)
|
|
#define ENCODER_PNUM 2000
|
|
#elif (TRIGGER_TYPE == TRG_ECD_AB4)
|
|
#define ENCODER_PNUM 4000
|
|
#else
|
|
|
|
#endif
|
|
|
|
typedef struct
|
|
{
|
|
u32 stspd;
|
|
u32 runspd;
|
|
u32 add;
|
|
u32 brkadd;
|
|
}spdCtrl;
|
|
|
|
//#define OutputStepOn() SetMoto1StepOn()
|
|
#define OutputStepOff() SetMoto1StepOff()
|
|
#define OutputDirOn() SetMoto1DirOn()
|
|
#define OutputDirOff() SetMoto1DirOff()
|
|
|
|
void InitSewHeadBoard(void);
|
|
void SewHeadBoardTask(void);
|
|
void APIntProc(void);
|
|
void BPIntProc(void);
|
|
void ZPIntProc(void);
|
|
void SoftPwmIntProc(void);
|
|
#endif
|
|
#endif /* APP_SEWHEAD_H_ */
|