MosResCalib.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #include "typedefine.h"
  2. #ifndef __MOSRESCALIB_H
  3. #define __MOSRESCALIB_H
  4. #define BIT0 0x0001 /*!< number 0 */
  5. #define BIT1 0x0002 /*!< number 1 */
  6. #define BIT2 0x0004 /*!< number 2 */
  7. #define BIT3 0x0008 /*!< number 3 */
  8. #define BIT4 0x0010 /*!< number 4 */
  9. #define BIT5 0x0020 /*!< number 5 */
  10. #define BIT6 0x0040 /*!< number 6 */
  11. #define BIT7 0x0080 /*!< number 7 */
  12. #define BIT8 0x0100 /*!< number 8 */
  13. #define BIT9 0x0200 /*!< number 9 */
  14. #define BIT10 0x0400 /*!< number 10 */
  15. #define BIT11 0x0800 /*!< number 11 */
  16. #define BIT12 0x1000 /*!< number 12 */
  17. #define BIT13 0x2000 /*!< number 13 */
  18. #define BIT14 0x4000 /*!< number 14 */
  19. #define BIT15 0x8000 /*!< number 15 */
  20. #define MAXCURCOF 52958
  21. #define delay_time 64 //开管牙齿时间 ,单位128us
  22. #define LIBCURMIN (7<<14)/60 //7A
  23. #define LIBCURMAX (20<<14)/60 //20A
  24. typedef enum
  25. {
  26. FSMCALINULL=0,
  27. FSMCALIA = 1,
  28. FSMCALIB = 2,
  29. FSMCALIC = 3
  30. } CALIB_Struct;
  31. typedef struct
  32. {
  33. //UWORD uwMOS_Ra;
  34. //UWORD uwMOS_Rb;
  35. //UWORD uwMOS_Rc;
  36. //SWORD swPCBTEMP;
  37. //BOOL Samp_A_COMIT;
  38. //BOOL Samp_B_COMIT;
  39. //BOOL Samp_C_COMIT;
  40. BOOL blCalibFlag;
  41. BOOL bllibFinishFlag;
  42. BOOL blCalibFault;
  43. }MOSINSIDE_Struct;
  44. typedef struct
  45. {
  46. UWORD K50;
  47. UWORD K75;
  48. UWORD K100;
  49. UWORD K125;
  50. UWORD K150;
  51. }K_Struct;
  52. typedef struct
  53. {
  54. UWORD uwTEMP_RES0;//0度电阻值
  55. UWORD uwTEMP_RES1;//25度电阻值
  56. UWORD uwTEMP_RES2;//50度电阻值
  57. UWORD uwTEMP_RES3;//75度电阻值
  58. UWORD uwTEMP_RES4;//100度电阻值
  59. UWORD uwTEMP_RES5;//125度电阻值
  60. UWORD uwTEMP_RES6;//150度电阻值
  61. UWORD uwTEMP_libres;//当下环境下的电阻值
  62. UWORD swTEMP;//当下温度值
  63. }TEMP_RES_Struct;
  64. typedef struct
  65. {
  66. SWORD uwMOS_i_Value;//MOS电流
  67. UWORD uwCalRes_i_Value;//校准电阻电流
  68. //K_Struct uwMOS_K; //k值
  69. UWORD uwCalib_R_Value ;//实时温度对应的电阻
  70. TEMP_RES_Struct RES; //不同温度下的电阻值
  71. UWORD uwMaxiPhoseCurAp;//相电流系数
  72. UWORD uwCurReg2Pu;//相电流系数
  73. UWORD uwCurRegPu_25d;//相电流系数
  74. UWORD MOS_i_ValueCOM[50];
  75. UWORD Res_i_ValueCOM[50];
  76. }MOSCALIB_Struct;
  77. typedef struct
  78. {
  79. UWORD CM1;
  80. UWORD CM2;
  81. UWORD CCTRL;
  82. } phase_Struct;
  83. typedef struct
  84. {
  85. UWORD PWM1;
  86. UWORD PWM2;
  87. UWORD PWM3;
  88. } phasePWM_Struct;
  89. extern MOSCALIB_Struct MosCal_A;
  90. extern MOSCALIB_Struct MosCal_B;
  91. extern MOSCALIB_Struct MosCal_C;
  92. extern MOSINSIDE_Struct MosResInside;
  93. void MosResRead(void);
  94. void ReceiveCmdHandle(void);
  95. void MosResHandle(MOSCALIB_Struct *moscal,ADC_SUMCOF *K);
  96. void CalcTempRes(MOSCALIB_Struct *y,MOSEEPROM_Struct *Eep);
  97. void CalcResVaule(MOSCALIB_Struct *y , SWORD Temp);
  98. void CalcMaXAdcCur(MOSCALIB_Struct *y);
  99. #endif