| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #ifndef __MYPROJECT_H_
- #define __MYPROJECT_H_
- #include <FU68xx_5.h>
- #include <FU68xx_5_Type.h>
- #include <Customer.h>
- #include <Parameter.h>
- #include <AddFunction.h>
- #include <Protect.h>
- #include <ProtectSet.h>
- #include <VoltageCompensation.h>
- // math.h包含算术运算的数学函数
- #include <math.h>
- #include <Definition.h>
- typedef enum
- {
- mcReady = 0,
- mcInit = 1,
- mcCharge = 2,
- mcTailWind = 3,
- mcPosiCheck = 4,
- mcAlign = 5,
- mcStart = 6,
- mcRun = 7,
- mcStop = 8,
- mcFault = 9,
- mcBrake = 10
- }MotStaType;
- typedef union
- {
- uint8 SetMode; // 整个配置模式使能位
- struct
- {
- uint8 AlignSetFlag :1; // 预定位配置标志位
- } SetFlag;
- }MotStaM;
- extern MotStaType mcState;
- extern MotStaM McStaSet;
- void CMP0_Init(void);
- void CMP3_Init(void);
- void CMP3_Interrupt_Init(void);
- void CMP5_Init(void);
- void Timer2_Init(void);
- void Timer3_Init(void);
- void Timer4_Init(void);
- void SPI_Init(void);
- void WatchDogConfig(uint32 value, uint8 Status);
- unsigned short CRC_Check(unsigned char start_sector , unsigned char offset_sector);
- extern void FOC_Init(void);
- extern void Motor_Open(void);
- extern void Motor_Align(void);
- #if (FiledWeakenCompEnable)
- typedef struct
- {
- uint16 FieldWeakenActualUS_Q15;
- uint16 FieldWeakenActualDcbus_Q15;
- int16 FieldWeakenIsTheta;
- int16 mcIqref;
- int16 mcIdref;
- }FieldWeakeningTypeDef;
- FieldWeakeningTypeDef xdata mcFieldWeaken;
- void GetFieldWeakenUsAndUdc_Q15(int16 Ud, int16 Uq , uint16 Dcbus);
- void GetFieldWeakenIdRefAndIqRef_Q15(int16 Is);
- void GetFieldWeakenIsTheta_Q15(void);
- int16 mcFieldWeakenPI(int16 feedbackvalue, int16 referencevalue);
- void FiledWeakenControl(int16 Ud, int16 Uq , uint16 Dcbusk,int16 Is);
- #endif
- #define P_Power(POWER) _Q15(POWER*2/HW_BOARD_CURR_BASE/HW_BOARD_VOLTAGE_BASE/1.5)
- #define DAC_OvercurrentValue (_Q8(I_ValueX(OverHardcurrentValue ))+0x7F)
- #endif
|