ZDBMS/header_drv/Calculate.h

45 lines
1.1 KiB
C

#ifndef __CALCULATE_H
#define __CALCULATE_H
#if (AFE_ID == 0x34)
#define REF_RES_VAL (680 + 5*ucMTPBuffer[25]) //resistance = (680 + 5*TR[6~0])*10, The unit is 10 ohms
#else
#define REF_RES_VAL 1000 //芯片内部的参考电阻默认为10K=1000*10, 单位是10 ohms
#endif
#define NTC_103AT_3435 0
#define NTC_103AT_3950 0
#define NTC_SL 1
#define RT_TABLE NTC_SL
#if RT_TABLE == NTC_103AT_3435
#define NTC103AT_ARRAY_LEN 161
#define TEMP_UPPER_LIMIT 110 // 110℃
#define TEMP_LOWER_LIMIT -50 // -50℃
#elif RT_TABLE == NTC_103AT_3950
#define NTC103AT_ARRAY_LEN 161
#define TEMP_UPPER_LIMIT 110 // 110℃
#define TEMP_LOWER_LIMIT -50 // -50℃
#elif RT_TABLE == NTC_SL
#define NTC103AT_ARRAY_LEN 121
#define TEMP_UPPER_LIMIT 100 // 100℃
#define TEMP_LOWER_LIMIT -20 // -20℃
#else
#error "underfined RT_TABLE!"
#endif
extern U16 code NTC103AT[NTC103AT_ARRAY_LEN];
extern U8 xdata ucChgingCheckCnt;
extern U8 xdata ucDsgingCheckCnt;
extern void AfeCalcuVol(void);
extern void AfeCalcuTempe(void);
extern void AFEInfoProcess(void);
extern U16 CalcuTemp(U16 getdata);
#endif