123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- /*
- * var.h
- *
- * Created on: 2023Äê5ÔÂ17ÈÕ
- * Author: wangd
- */
- #ifndef USERSOURCE_VAR_H_
- #define USERSOURCE_VAR_H_
- #include "IQmathLib.h"
- #include "DSP2803x_Device.h" // DSP2803x Headerfile Include File
- #include "pi.h" // Include header for the PIDREG3 object
- #include "speed_pr.h" // Include header for the SPEED_MEAS_REV object
- #include "rmp_cntl.h" // Include header for the RMPCNTL object
- #include "f2803xbldcpwmstruct.h"
- #include "f2803xhall_gpio_struct.h" // Include header for the HALL object
- #define PIXHAWK 1
- //#define DEBUG_CAN 1
- #define ESC_NUMBER 0x08
- #define SPEEDCLOSED 1
- //#define MOTORLEFT 1
- #ifndef DSP28_DATA_TYPES
- #define DSP28_DATA_TYPES
- typedef int int16;
- typedef long int32;
- typedef unsigned int Uint16;
- typedef unsigned long Uint32;
- typedef float float32;
- typedef long double float64;
- #endif
- #define SOFTCURlIMIT 8 //A
- #define MAINLOOPRATE 8 //Khz
- #define MAINLOOPTIME 125 //US
- #define VOLTAGEUP 370 //V
- #define VOLTAGELOW 250 //V
- #define SPEEDUP 4200 //RPM
- #define MOTORTEMPLIMIT 70 //
- #define MOTORTEMPOVER 85 //
- #define IGBTTEMPOVER 65 //
- #define MAINLOOPFREQ 8000
- struct FAULTFLAG_STR
- {
- Uint16 OverMotTempFlag:1;
- Uint16 IgbtTempFaultFlag:1;
- Uint16 LowVolFlag:1;
- Uint16 SoftOverCurFlag:1;
- Uint16 LimitMotTempFlag:1;
- Uint16 rsv1:3;
- Uint16 OverVolFlag:1;
- Uint16 CanErrFlag:1;
- Uint16 OverCurFlag:1;
- Uint16 Ipmfault:1;
- Uint16 OverRpmFlag:1;
- Uint16 HallFlag:1;
- Uint16 rsv2:2;
- };
- union FAULTFLAG_UNI
- {
- Uint16 all;
- struct FAULTFLAG_STR bit;
- };
- extern union FAULTFLAG_UNI FaultFlag;
- extern int16 PwmSet ;
- extern Uint32 startuptimer;
- extern Uint32 IsrTime;
- extern _iq test ;
- extern int16 test2;
- extern int16 test3;
- extern int16 test4;
- extern int16 test5;
- extern int16 test7;
- extern int16 Tmotor;
- extern PI_CONTROLLER pid1_idc;
- extern PI_CONTROLLER pid1_spd;
- extern RMPCNTL rc1;
- extern PWMGEN pwm1;
- extern SPEED_MEAS_CAP speed1;
- extern HALL3 hall1;
- extern int32 pwmlimit;
- extern _iq SpeedRef;
- extern int16 Direction;
- extern _iq BemfA;
- extern _iq BemfB;
- extern _iq BemfC;
- extern _iq Iphase;
- extern Uint16 DCbus_voltage;
- extern _iq12 DC_current_real ;
- extern _iq DC_current_filer;
- extern int16 Tvot ;
- extern int16 Tmotor ;
- extern _iq CurrentSet;
- extern int32 DC_current_avr;
- extern int32 DC_current_filter_avr;
- extern Uint16 Fault_clear;
- extern int32 XintTime;
- extern int16 t4;
- extern volatile Uint16 EnableFlag;
- extern volatile Uint16 Enable_ALLOW;
- extern void InitVar(void);
- extern void OverVoltage(void);
- extern void FaultTreat(void);
- extern void OverMotCtrTemp(void);
- extern void OverMotorRpm(void);
- extern void OpenPwm(void);
- extern void Fault_clear_fuc(void);
- extern int16 LimitMotCtrTemp(int32 period);
- extern void SoftOverCurFlag(void);
- extern void speed_cal_filter(void);
- extern void carveData2();
- #endif /* USERSOURCE_VAR_H_ */
|