RSDDetect.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @copyright (C) COPYRIGHT 2022 Fortiortech Shenzhen
  3. * @file RSDDetect.h
  4. * @author Fortiortech Appliction Team
  5. * @since Create:2022-07-14
  6. * @date Last modify:2022-07-14
  7. * @note Last modify author is Marcel
  8. * @brief This file contains tailWind detection used for Motor Control.
  9. */
  10. #ifndef __RSDDETECT_H_
  11. #define __RSDDETECT_H_
  12. #include "FU68xx_5.h"
  13. #include "Customer.h"
  14. #include <MotorControl.h>
  15. /** RSD参数变量 */
  16. typedef struct
  17. {
  18. uint16 StepTime[4]; ///< 一个脉冲的周期值
  19. uint8 Times; ///< 进入RSD中断次数
  20. uint16 Period; ///< 电周期值,除数不能超过16位
  21. int16 Count; ///< 当前脉冲数
  22. int16 CountPre; ///< 上一个状态脉冲数
  23. int16 State; ///< RSD的状态
  24. int16 Speed; ///< RSD的速度
  25. uint8 SpeedUpdate; ///< 速度更新标志
  26. uint8 HighSpdStart;
  27. uint32 RSDSpeedBase; ///< RSD的速度基准
  28. uint16 RSDCCWSBRCnt; ///< RSD反转后启动前刹车计数
  29. uint8 RSDStep; ///< 速度捕获计数
  30. uint8 SetFR;
  31. uint8 Status;
  32. uint8 ArrCnt;
  33. }MotorRSDTypeDef;
  34. #define RSDSpeedCalBase (uint32)(32767*TIM2_Fre*15/Pole_Pairs/MOTOR_SPEED_BASE)
  35. #define RSDSpeedCalMaxSpeed (uint16)(TIM2_Fre*15/Pole_Pairs/MOTOR_SPEED_BASE)+1
  36. #define FORWARD (1)
  37. #define REVERSE (2)
  38. #define STATIC (3)
  39. #define DETECTING (0)
  40. extern MotorRSDTypeDef mcRsd;
  41. extern void RsdProcess(void);
  42. extern void RSDTailWindStart(void);
  43. extern void RSDDetectInit(void);
  44. extern MotStateType RSDStartProcess(void);
  45. /****************************end RSD参数变量*******************************/
  46. #endif