123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- /*********************************************************************
- *
- * NTC28 C File
- *
- *********************************************************************
- * FileName: NTC28.c
- * Processor: PIC18F45K80
- * Complier: Microchip C18 v3.41
- * Company: KIT - CN - IPE
- *
- * Author Date Comment
- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * Ott W. 01.06.2016 Release 1.
- *********************************************************************/
- #include "BMS_Slave.h"
- /*********************************************************************
- *
- * Globals
- *
- *********************************************************************/
- /* Look Up Table für NTC103JT-025-3P Temperaturbestimmung von -50°C bis +90°C in 1°K Schritten */
- const rom int16_t NTC_LookUp[142]= /*!e950*/
- {4511,4503,4496,4488,4479,4470,4461,4452,4441,4431,
- 4420,4408,4396,4383,4370,4356,4342,4327,4311,4295,
- 4278,4261,4242,4223,4204,4183,4162,4140,4118,4095,
- 4071,4046,4020,3993,3965,3937,3908,3878,3847,3816,
- 3784,3751,3717,3682,3647,3611,3574,3537,3499,3461,
- 3422,3382,3341,3300,3259,3217,3175,3132,3090,3046,
- 3002,2959,2914,2870,2825,2781,2736,2691,2647,2603,
- 2558,2513,2469,2425,2381,2337,2293,2250,2206,2164,
- 2121,2079,2037,1996,1955,1914,1875,1835,1796,1758,
- 1720,1683,1646,1610,1574,1539,1505,1471,1438,1405,
- 1373,1342,1311,1280,1250,1221,1193,1165,1137,1110,
- 1084,1059,1034,1009,985,962,939,916,895,873,
- 853,832,812,793,774,756,738,720,703,686,
- 670,654,638,623,608,594,580,566,553,539,
- 527,515};
- /*********************************************************************
- * Function: int8_t LTC_CONV_UMESS_2_TEMP( int16_t Umess )
- *
- * Overview: Use this function to convert Umess 2 Temperature
- * for Temperature Sensor 103JT-025-3P
- *
- * PreCondition: None
- *
- * Input: Voltage [mV] [0..5000mV]
- *
- * Output: Temperature [°C] [-50°C..+90°C]
- * -51°C = Underflow; +91°C = Overflow
- *
- * Side Effects: None
- **********************************************************************/
- int8_t LTC_CONV_UMESS_2_TEMP( int16_t Umess )
- {
- int8_t Temp = -51;
- uint8_t i = 0;
-
- if(Umess < 516) /* OverFlow (>90°C) */
- {
- Temp = 91; /* Break Search */
- }
- else
- {
- while((NTC_LookUp[i] >= Umess))
- {
- i++;
- Temp++;
- }
- }
- return Temp;
- }
|