123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- /**
- * @file ntc_sensor.c
- * @author zhouxiong(wangzy49@midea.com)
- * @brief
- * @version 0.1
- * @date 2021-10-08
- *
- * @copyright Copyright (c) 2021
- *
- */
- /************************************************************************
- Beginning of File, do not put anything above here except notes
- Compiler Directives:
- *************************************************************************/
- #include "ntc_sensor.h"
- /******************************
- *
- * Parameter
- *
- ******************************/
- //PCB温度传感器寄存器与温度对照表,-40~140摄氏度
- const UWORD NTC_Table_PCB[181] =
- {
- 99,
- 107,
- 114,
- 123,
- 131,
- 140,
- 150,
- 160,
- 171,
- 183,
- 195,
- 208,
- 221,
- 235,
- 250,
- 265,
- 282,
- 299,
- 317,
- 335,
- 355,
- 375,
- 397,
- 419,
- 442,
- 466,
- 491,
- 517,
- 544,
- 571,
- 600,
- 630,
- 660,
- 692,
- 724,
- 758,
- 792,
- 828,
- 864,
- 901,
- 939,
- 977,
- 1017,
- 1057,
- 1098,
- 1140,
- 1182,
- 1225,
- 1269,
- 1313,
- 1357,
- 1402,
- 1447,
- 1493,
- 1539,
- 1585,
- 1631,
- 1678,
- 1724,
- 1771,
- 1817,
- 1864,
- 1910,
- 1956,
- 2002,
- 2048,
- 2093,
- 2138,
- 2182,
- 2227,
- 2270,
- 2314,
- 2356,
- 2398,
- 2440,
- 2481,
- 2521,
- 2561,
- 2600,
- 2639,
- 2676,
- 2713,
- 2749,
- 2785,
- 2820,
- 2854,
- 2887,
- 2920,
- 2952,
- 2983,
- 3014,
- 3043,
- 3072,
- 3101,
- 3128,
- 3155,
- 3181,
- 3207,
- 3232,
- 3256,
- 3280,
- 3303,
- 3325,
- 3347,
- 3368,
- 3388,
- 3408,
- 3427,
- 3446,
- 3464,
- 3482,
- 3499,
- 3516,
- 3532,
- 3548,
- 3563,
- 3578,
- 3593,
- 3607,
- 3620,
- 3633,
- 3646,
- 3659,
- 3671,
- 3682,
- 3694,
- 3705,
- 3715,
- 3726,
- 3736,
- 3745,
- 3755,
- 3764,
- 3773,
- 3781,
- 3790,
- 3798,
- 3806,
- 3813,
- 3821,
- 3828,
- 3835,
- 3842,
- 3848,
- 3855,
- 3861,
- 3867,
- 3873,
- 3878,
- 3884,
- 3889,
- 3894,
- 3899,
- 3904,
- 3909,
- 3914,
- 3918,
- 3922,
- 3927,
- 3931,
- 3935,
- 3939,
- 3942,
- 3946,
- 3950,
- 3953,
- 3957,
- 3960,
- 3963,
- 3966,
- 3969,
- 3972,
- 3975,
- 3978,
- 3980,
- 3983,
- 3985,
- 3988,
- 3990,
- 3993,
- 3995
- };
- //力矩温度传感器寄存器与温度对照表,-40~140摄氏度
- const UWORD NTC_Table_Torque[181] =
- {
- 3996,
- 3988,
- 3981,
- 3972,
- 3964,
- 3955,
- 3945,
- 3935,
- 3924,
- 3912,
- 3900,
- 3887,
- 3874,
- 3860,
- 3845,
- 3830,
- 3813,
- 3796,
- 3778,
- 3760,
- 3740,
- 3720,
- 3698,
- 3676,
- 3653,
- 3629,
- 3604,
- 3578,
- 3551,
- 3524,
- 3495,
- 3465,
- 3435,
- 3403,
- 3371,
- 3337,
- 3303,
- 3267,
- 3231,
- 3194,
- 3156,
- 3118,
- 3078,
- 3038,
- 2997,
- 2955,
- 2913,
- 2870,
- 2826,
- 2782,
- 2738,
- 2693,
- 2648,
- 2602,
- 2556,
- 2510,
- 2464,
- 2417,
- 2371,
- 2324,
- 2278,
- 2231,
- 2185,
- 2139,
- 2093,
- 2048,
- 2002,
- 1957,
- 1913,
- 1868,
- 1825,
- 1781,
- 1739,
- 1697,
- 1655,
- 1614,
- 1574,
- 1534,
- 1495,
- 1456,
- 1419,
- 1382,
- 1346,
- 1310,
- 1275,
- 1241,
- 1208,
- 1175,
- 1143,
- 1112,
- 1081,
- 1052,
- 1023,
- 994,
- 967,
- 940,
- 914,
- 888,
- 863,
- 839,
- 815,
- 792,
- 770,
- 748,
- 727,
- 707,
- 687,
- 668,
- 649,
- 631,
- 613,
- 596,
- 579,
- 563,
- 547,
- 532,
- 517,
- 502,
- 488,
- 475,
- 462,
- 449,
- 436,
- 424,
- 413,
- 401,
- 390,
- 380,
- 369,
- 359,
- 350,
- 340,
- 331,
- 322,
- 314,
- 305,
- 297,
- 289,
- 282,
- 274,
- 267,
- 260,
- 253,
- 247,
- 240,
- 234,
- 228,
- 222,
- 217,
- 211,
- 206,
- 201,
- 196,
- 191,
- 186,
- 181,
- 177,
- 173,
- 168,
- 164,
- 160,
- 156,
- 153,
- 149,
- 145,
- 142,
- 138,
- 135,
- 132,
- 129,
- 126,
- 123,
- 120,
- 117,
- 115,
- 112,
- 110,
- 107,
- 105,
- 102,
- 100
- };
- /***************************************************************
- Function: Get PCB Temp
- Description:
- Call by:
- Input Variables: N/A
- Output/Return Variables: N/A
- Subroutine Call: N/A;
- Reference: N/A
- ****************************************************************/
- SWORD GetPCBTemp(UWORD ADC_Result)
- {
- UBYTE Count;
-
- for(Count=0; Count<181; Count++)
- {
- if(ADC_Result <= NTC_Table_PCB[Count])
- {
- return (SWORD)(Count - 40);
- }
- }
- return -40;
- }
- /***************************************************************
- Function: Get Torque Temp
- Description:
- Call by:
- Input Variables: N/A
- Output/Return Variables: N/A
- Subroutine Call: N/A;
- Reference: N/A
- ****************************************************************/
- SWORD GetTorqueTemp(UWORD ADC_Result)
- {
- UBYTE Count;
-
- for(Count=0; Count<181; Count++)
- {
- if(ADC_Result >= NTC_Table_Torque[Count])
- {
- return (SWORD)(Count - 40);
- }
- }
- return -40;
- }
- /*************************************************************************
- End of this File (EOF)!
- Do not put anything after this part!
- *************************************************************************/
|