Myproject.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef __MYPROJECT_H_
  2. #define __MYPROJECT_H_
  3. #include <FU68xx_5.h>
  4. #include <FU68xx_5_Type.h>
  5. #include <Customer.h>
  6. #include <Parameter.h>
  7. #include <AddFunction.h>
  8. #include <DMA.h>
  9. #include <UART.h>
  10. #include <Pfc.h>
  11. #include <Communication.h>
  12. #include <UART_4800.h>
  13. #include <Protect.h>
  14. #include <ProtectSet.h>
  15. #include <PfcSet.h>
  16. #include <commution.h>
  17. #include <Parameter.h>
  18. #include <VoltageCompensation.h>
  19. #include <SYS_Ctr_main.h>
  20. #include <User_Dri_main.h>
  21. #include <other.h>
  22. #include <Definition.h>
  23. typedef enum
  24. {
  25. mcReady = 0,
  26. mcInit = 1,
  27. mcCharge = 2,
  28. mcTailWind = 3,
  29. mcPosiCheck = 4,
  30. mcAlign = 5,
  31. mcStart = 6,
  32. mcRun = 7,
  33. mcStop = 8,
  34. mcFault = 9,
  35. mcBrake = 10
  36. }MotStaType;
  37. typedef union
  38. {
  39. uint8 SetMode; // 整个配置模式使能位
  40. struct
  41. {
  42. uint8 CalibFlag :1; // 电流校准的标志位
  43. uint8 ChargeSetFlag :1; // 预充电配置标志位
  44. uint8 AlignSetFlag :1; // 预定位配置标志位
  45. uint8 TailWindSetFlag :1; // 顺逆风配置标志位
  46. uint8 StartSetFlag :1; // 启动配置标志位
  47. uint8 PosiCheckSetFlag :1; // 位置检测配置标志位
  48. } SetFlag;
  49. }MotStaM;
  50. extern MotStaType mcState;
  51. extern MotStaM McStaSet;
  52. void CMP0_Init(void);
  53. void CMP3_Init(void);
  54. void CMP3_Interrupt_Init(void);
  55. void CMP5_Init(void);
  56. void Timer2_Init(void);
  57. void Timer3_Init(void);
  58. void Timer4_Init(void);
  59. void SysTick(void);
  60. void SPI_Init(void);
  61. void WatchDogConfig(uint32 value, uint8 Status);
  62. unsigned short CRC_Check(unsigned char start_sector , unsigned char offset_sector);
  63. typedef struct
  64. {
  65. int16 IuOffset; //Iu的偏置电压
  66. int32 IuOffsetSum; //Iu的偏置电压总和
  67. int16 IvOffset; //Iv的偏置电压
  68. int32 IvOffsetSum; //Iv的偏置电压总和
  69. int16 Iw_busOffset; //Iw或Ibus的偏置电压
  70. int32 Iw_busOffsetSum;//Iw或Ibus的偏置电压总和
  71. int16 OffsetCount; //偏置电压采集计数
  72. int8 OffsetFlag; //偏置电压结束标志位
  73. }CurrentOffset;
  74. extern CurrentOffset xdata mcCurOffset;
  75. extern void Get_Current_Offset(void);
  76. extern void FOC_Init(void);
  77. extern void Motor_Charge(void);
  78. extern void Motor_Open(void);
  79. extern void Motor_Align(void);
  80. #if (FiledWeakenCompEnable==1)
  81. typedef struct
  82. {
  83. uint16 FieldWeakenActualUS_Q15;
  84. uint16 FieldWeakenActualDcbus_Q15;
  85. int16 FieldWeakenIsTheta;
  86. int16 mcIqref;
  87. int16 mcIdref;
  88. }FieldWeakeningTypeDef;
  89. /* Exported variables ---------------------------------------------------------------------------*/
  90. extern FieldWeakeningTypeDef xdata mcFieldWeaken;
  91. extern void GetFieldWeakenUsAndUdc_Q15(int16 Ud, int16 Uq , uint16 Dcbus);
  92. extern void GetFieldWeakenIdRefAndIqRef_Q15(int16 Is);
  93. extern void GetFieldWeakenIsTheta_Q15(void);
  94. extern int16 mcFieldWeakenPI(int16 feedbackvalue, int16 referencevalue);
  95. extern void FiledWeakenControl(int16 Ud, int16 Uq , uint16 Dcbusk,int16 Is);
  96. #endif
  97. #endif