NTC temperature sensor going to A:D input. Topology is: (Vref or 3.3V) -> Series_resistor -> A:D_input -> NTC -> GND. Easy modification of NTC parameters w/o recompile of library

Dependents:   ntc_helloworld

Revision:
2:c843c06cc651
Parent:
1:2314fd8959b2
Child:
3:1eb4f5296281
--- a/ntc.h	Fri Apr 07 00:39:59 2017 +0000
+++ b/ntc.h	Fri Apr 07 16:36:47 2017 +0000
@@ -51,8 +51,43 @@
     /** NTC temperature A:D conversion
      *
      * @code
-     *      //
-     *      //
+     *  #include "mbed.h"
+     *  #include "ntc.h" 
+     *
+     *  
+     *  const NTC_TypeDef ntc_my_paramtr = {
+     *    // Vref
+     *    3.3f,               // Vref
+     *    65535.0f,           // A:D 16-bit resolution
+     *    // muRata NCP15XH103J03RC
+     *    10000,              // NTC resistance
+     *    5,                  // NTC initial tolerance
+     *    3380,               // NTC B25/50
+     *    3428,               // NTC B25/80
+     *    3434,               // NTC B25/85
+     *    3355,               // NTC B25/100
+     *    1,                  // NTC beta tolerance
+     *    // 3.32k 1% 100ppm
+     *    3320,               // Series resistor value
+     *    1,                  // Series resistor tolerance
+     *    100                 // Series Resistor tempco ppm
+     *  };    
+     *
+     *  NTC ntc(A1, &ntc_my_paramtr);                   //initialize NTC temperature A:D
+     * 
+     *  main() {
+     *      printf("\r\n\r\n-------------------------------------------\r\n");
+     *      printf("NTC Res: %5d   B25/50: %4d   B25/80: %4d   B25/85: %4d   B25/100: %4d   SeriesR: %d\r\n", 
+     *              ntc.get_ntc_res(), ntc.get_ntc_beta_2550(), ntc.get_ntc_beta_2580(), ntc.get_ntc_beta_2585(), ntc.get_ntc_beta_25100(),  ntc.get_series_res());
+     *      uint16_t ad = ntc.read_ad_reg();
+     *      printf("NTC A:D Val: %5d   Volt A:D: %.6f   NTC-R_now: %7.1f    Temp: %+.2f\r\n", ad, 3.3f / 65536.0f * (float)ad, ntc.get_ntc_res_viaAD(ad), ntc.get_ntc_temp(NTC::B25_85, ad));
+     *
+     *      while(1) {
+     *          printf("Temp: %+.2f\r\n", ntc.get_ntc_temp(NTC::B25_85));
+     *          wait(2.0);
+     *      }
+     *          
+     *  }         
      * @endcode
      */
  
@@ -128,7 +163,7 @@
       * @param none
       * @param din optional read from read_ad_reg().
       * @param din if missing or 0, read_ad_reg() is executed first.
-      * @param din if != 0, then local value of rawdata is used.
+      * @param din if != 0, then local value of din is used.
       * @return resistance of NTC
       */
     float get_ntc_res_viaAD(uint16_t din = NULL);
@@ -137,7 +172,7 @@
       * @param curve Beta curve to use. See ntcBetaCurve {};
       * @param din optional read from read_ad_reg().
       * @param din if missing or 0, read_ad_reg() is executed first.
-      * @param din if != 0, then local value of rawdata is used.
+      * @param din if != 0, then local value of din is used.
       * @return temperature of NTC
       */
     float get_ntc_temp(int curve, uint16_t din = NULL);