Mahesh Phalke / tempsensors_prv
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ntc_10k_44031.cpp Source File

ntc_10k_44031.cpp

Go to the documentation of this file.
00001 /*!
00002  *****************************************************************************
00003   @file:  ntc_10k_44031.cpp
00004 
00005   @brief: This file contains functionality for 10K NTC 44021 model
00006 
00007   @details:
00008  -----------------------------------------------------------------------------
00009  Copyright (c) 2021 Analog Devices, Inc.  All rights reserved.
00010 
00011  This software is proprietary to Analog Devices, Inc. and its licensors.
00012  By using this software you agree to the terms of the associated
00013  Analog Devices Software License Agreement.
00014 
00015 *****************************************************************************/
00016 
00017 #include <math.h>
00018 #include "thermistor.h"
00019 #include "ntc_10k_44031.h"
00020 
00021 #ifdef DEFINE_LOOKUP_TABLES
00022 /* 10K NTC look-up table. Values are resistance in ohm for temperature
00023  * range from -10 to 80C with +/-1C tolerance.
00024  * @note This function uses Steinhart-Hart equation for deriving look-up table.
00025 **/
00026 const uint32_t ntc_10k_44031rc::lut[] = {
00027     47561,  45285,  43131,  41091,  39158,  37327,  35591,  33946,  32385,
00028     30905,  29500,  28166,  26900,  25697,  24555,  23470,  22438,  21457,
00029     20524,  19637,  18792,  17989,  17224,  16495,  15801,  15140,  14510,
00030     13910,  13337,  12791,  12271,  11774,  11299,  10847,  10414,  10002,
00031     9607,   9231,   8870,   8526,   8197,   7882,   7581,   7293,   7018,
00032     6754,   6501,   6259,   6028,   5806,   5593,   5389,   5194,   5006,
00033     4827,   4654,   4489,   4331,   4178,   4032,   3892,   3757,   3628,
00034     3503,   3384,   3269,   3159,   3053,   2951,   2852,   2758,   2667,
00035     2580,   2496,   2415,   2337,   2262,   2189,   2120,   2053,   1988,
00036     1926,   1866,   1808,   1752,   1698,   1646,   1596,   1548,   1501,
00037     1456
00038 };
00039 #endif
00040 
00041 
00042 /*!
00043  * @brief   This is a constructor for ntc_10k_44031rc class
00044  * @return  none
00045  */
00046 ntc_10k_44031rc::ntc_10k_44031rc()
00047 {
00048     /* Coefficients of Steinhart-Hart equation for 10K NTC to convert
00049      * NTC resistance into equivalent temperature */
00050     ntc_10k_44031rc::coeff_A = 1.032*pow(10, -3);
00051     ntc_10k_44031rc::coeff_B = 2.387*pow(10, -4);
00052     ntc_10k_44031rc::coeff_C = 1.580*pow(10, -7);
00053 
00054 #ifdef DEFINE_LOOKUP_TABLES
00055     ntc_10k_44031rc::lut_offset = -10;  /* Min temperature obtained through LUT */
00056     ntc_10k_44031rc::lut_size = 90;     /* Temperature range defined in LUT
00057                                            [lut_offset : lut_size - lut_offset] */
00058 #endif
00059 }
00060 
00061 
00062 /*!
00063  * @brief   Convert the thermistor resistance into equivalent temperature using
00064  *          Steinhart-Hart equation for 10K 44031 NTC
00065  * @param   resistance[in] - thermistor resistance
00066  * @return  Thermistor temperature value
00067  */
00068 float ntc_10k_44031rc::convert(const float resistance)
00069 {
00070     return thermistor::convert(resistance, coeff_A, coeff_B, coeff_C);
00071 }
00072 
00073 
00074 #ifdef DEFINE_LOOKUP_TABLES
00075 /*!
00076  * @brief   Convert the thermistor resistance into equivalent temperature using
00077  *          lookup table for 10K 44031 NTC
00078  * @param   resistance[in] - thermistor resistance
00079  * @return  Thermistor temperature value
00080  */
00081 float ntc_10k_44031rc::lookup(const float resistance)
00082 {
00083     return thermistor::lookup(lut, resistance, lut_size, lut_offset);
00084 }
00085 #endif