/* * 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 #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 350 //V #define VOLTAGELOW 200 //V #define SPEEDUP 3800 //RPM #define MOTORTEMPLIMIT 70 // #define MOTORTEMPOVER 90 // #define IGBTTEMPOVER 70 // #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:3; }; union FAULTFLAG_UNI { Uint16 all; struct FAULTFLAG_STR bit; }; extern union FAULTFLAG_UNI FaultFlag; extern Uint32 IsrTime; extern _iq test ; extern int16 test2; extern int16 test3; extern int16 test4; 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_ */