/****************************************************************************** 版权所有 (C), 2018-2099, Radkil ****************************************************************************** 文 件 名 : msp_motor_leisai.h 版 本 号 : 初稿 作 者 : radkil 生成日期 : 2026年7月13日 最近修改 : 功能描述 : 雷赛ISV2电机CAN协议实现 修改历史 : 1.日 期 : 2026年7月13日 作 者 : radkil 修改内容 : 创建文件 ******************************************************************************/ #ifndef __MOTOR_LEISAI_H__ #define __MOTOR_LEISAI_H__ #ifdef __cplusplus #if __cplusplus extern "C"{ #endif #endif /* __cplusplus */ /*==============================================* * include header files * *----------------------------------------------*/ #include "motor_manager.h" /*==============================================* * constants or macros define * *----------------------------------------------*/ // SDO命令字 #define LEISAI_SDO_CMD_READ 0x40 #define LEISAI_SDO_CMD_WRITE_1B 0x2F #define LEISAI_SDO_CMD_WRITE_2B 0x2B #define LEISAI_SDO_CMD_WRITE_3B 0x27 #define LEISAI_SDO_CMD_WRITE_4B 0x23 // CANopen 对象字典索引 #define LEISAI_OD_CONTROL_WORD 0x6040 #define LEISAI_OD_STATUS_WORD 0x6041 #define LEISAI_OD_MODE_OF_OPERATION 0x6060 #define LEISAI_OD_POSITION_ACTUAL 0x6064 #define LEISAI_OD_VELOCITY_ACTUAL 0x606C #define LEISAI_OD_TORQUE_ACTUAL 0x6077 #define LEISAI_OD_TARGET_VELOCITY 0x60FF #define LEISAI_OD_TARGET_POSITION 0x607A #define LEISAI_OD_ACCELERATION 0x6083 #define LEISAI_OD_DECELERATION 0x6084 #define LEISAI_OD_FAULT_CODE 0x603F #define LEISAI_OD_HOMING_METHOD 0x6098 #define LEISAI_OD_WATCHDOG_TIME 0x5004 // 操作模式 #define LEISAI_MODE_PROFILE_POS 0x01 #define LEISAI_MODE_PROFILE_VEL 0x03 #define LEISAI_MODE_HOMING 0x06 // 控制字命令 #define LEISAI_CTRL_SHUTDOWN 0x06 #define LEISAI_CTRL_SWITCH_ON 0x07 #define LEISAI_CTRL_ENABLE 0x0F #define LEISAI_CTRL_START_MOVE 0x5F #define LEISAI_CTRL_RELATIVE_MOVE 0x4F /*==============================================* * data structures * *----------------------------------------------*/ /*==============================================* * project-wide global variables * *----------------------------------------------*/ // 雷赛协议操作函数表(全局单例) extern const Motor_Protocol_t g_stLeiSaiProtocol; /*==============================================* * routines' or functions' implementations * *----------------------------------------------*/ /** * @brief 获取雷赛协议操作函数表 * @return 协议操作函数表指针 */ const Motor_Protocol_t* LeiSai_GetProtocol(void); #ifdef __cplusplus #if __cplusplus } #endif #endif /* __cplusplus */ #endif /* __MOTOR_LEISAI_H__ */