你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

基于NTC温度测量  

[复制链接]
wm20031015 发布时间:2015-2-2 10:13
阅读主题, 点击返回1楼
2 收藏 9 评论52 发布时间:2015-2-2 10:13
52个回答
wofei1314 回答时间:2015-12-27 21:12:27
谢谢分型!
dwwzl 回答时间:2015-12-28 08:52:01
推荐查表法
cqh757128 回答时间:2016-1-22 22:54:00
下载的多,回帖的少,这习惯不好
harvardx 回答时间:2016-1-23 00:42:40
查表法可以 5度一个表格就可以. 分压电阻要选好.
用了多少年了. 1度差不多可以吧.

  1. #define _GETAD(Rt) ( (uint16)( (Rt *1024UL)/(20000UL + Rt)))

  2. #if NTC_TYPE == NTC_NTSA0103F
  3. static uint16 RtADVal[] PROGMEM =
  4. {
  5.         //-40
  6.    _GETAD( 195650),  _GETAD( 148170),  _GETAD( 113340), _GETAD(87560),  _GETAD(68240),
  7.    _GETAD( 53650),   _GETAD( 42510),   _GETAD( 33890),  _GETAD(27220),  _GETAD(22021),
  8.    _GETAD( 17926),   _GETAD( 14674),   _GETAD( 12081),  _GETAD(10000),  _GETAD(8315),
  9.    _GETAD( 6948),    _GETAD( 5834),    _GETAD( 4917),   _GETAD(4161),   _GETAD(3535),
  10.    _GETAD( 3014),    _GETAD( 2586),    _GETAD( 2228),   _GETAD(1925),   _GETAD(1669),
  11.    _GETAD( 1452),    _GETAD( 1268),    _GETAD( 1110),   _GETAD(974),    _GETAD(858),
  12.    _GETAD( 758),     _GETAD( 671),     _GETAD( 596),    _GETAD(531)//125ceilsis
  13. };
  14. #elif NTC_TYPE == NTC_MF52
  15. static uint16 RtADVal[] PROGMEM =
  16. {
  17.         //-40                         //-35                                //-30                        //-25                                  //-20
  18.    _GETAD( 235830),  _GETAD( 173940),  _GETAD( 129916), _GETAD(98180),  _GETAD(75021),
  19.    _GETAD( 57926),   _GETAD( 45168),   _GETAD( 35548),  _GETAD(28223),  _GETAD(22594),//5
  20.    _GETAD( 18231),   _GETAD( 14820),   _GETAD( 12133),  _GETAD(10000),  _GETAD(8294), //30
  21.    _GETAD( 6921),    _GETAD( 5809),    _GETAD( 4903),   _GETAD(4160),   _GETAD(3547), //55
  22.    _GETAD( 3039),    _GETAD( 2615),    _GETAD( 2261),   _GETAD(1962),   _GETAD(1710), //80
  23.    _GETAD( 1496),    _GETAD( 1314),    _GETAD( 1158),   _GETAD(1024),    _GETAD(908), //105
  24.    _GETAD( 808),     _GETAD( 721),     _GETAD( 646),    _GETAD(580)//125ceilsis                  //130

  25. };
  26. #endif


  27. #undef         _GETAD
复制代码



  1. int16 sample_t(u08  Tchannel )                      //ζȲɼ¯º¯Êý
  2. {
  3.             uint16  T_AD_Val=0  ;

  4.     static  int16   temperature =0;

  5.             uint8   ResValPtr=0;

  6.      T_AD_Val    =  ADC_sample_with_filter(Tchannel); //ADC=1024*R/(R+20K)

  7.      ResValPtr   =  0;

  8.      if( T_AD_Val>=  929 )                            //ÉÏϱ߽紦Àí
  9.      {
  10.          temperature = (int16)(-400);

  11.          return      temperature    ;

  12.      }
  13.                                                    
  14.      if(T_AD_Val<= 26  )
  15.      {
  16.          temperature = (int16) 1250;

  17.          return        temperature ;

  18.      }  
  19.      
  20.     uint8 i;
  21.     for( i=0;i<7;i++)                          //²éÕÒÊý¾ÝÔÚ±í¸öµÄÄÄÒ»ÐÐ,¹²ÓÐ7ÐÐ
  22.     {
  23.         if(        T_AD_Val <= pgm_read_word( RtADVal+30-(5*i)) )
  24.         {
  25.                  ResValPtr=30- 5*i;
  26.                 
  27.                         break;
  28.         }
  29.     }

  30.     int16 temp1,temp2;                         //¶¨ÒåÁ½¸öÁÙʱ±äÁ¿ÓÃÓÚ¶ÁÈ¡±í¸ñ,·½±ã¼ÆËã
  31.     uint8 j;
  32.     for( j=0;j<5;j++)                          //²éÕÒÊý¾ÝÔÚ±í¸öµÄÄÄÁÐ,¹²ÓÐ5ÁÐ

  33.     {
  34.         if(T_AD_Val    >= pgm_read_word(RtADVal+ResValPtr+1+j))
  35.         {
  36.             temp1      = pgm_read_word(RtADVal+ResValPtr+j)  ; //temp1>temp2

  37.             temp2      = pgm_read_word(RtADVal+ResValPtr+1+j);

  38.             temperature= (int16)500*(int16)(ResValPtr+j+1) - (int16)500*(T_AD_Val-temp2)/(temp1-temp2)-(int16)4000;

  39.             temperature= temperature/10 ;

  40.            break;                   //return  temperature    ;      ´Ë¾äдÔÚ´Ë»á³öÏÖ
  41.         }                           //control reaches end of non-void functionµÄ¾¯¸æ
  42.      }
  43.      return       temperature    ;  //´Ë¾ä·ÅÔÚ´Ë£¬¾¯¸æÏûʧ£¬µ«ÊÇ´úÂëÔö¼Ó14bytes


  44. }
复制代码
harvardx 回答时间:2016-1-23 00:43:02
简单的 二分法查找 电阻值
tempchar 回答时间:2016-1-27 09:11:01
支持下楼主
8zhangben 回答时间:2016-3-24 18:44:32
学习!!!!!!!!!!!!
ffeige1984 回答时间:2016-7-31 20:06:58
收了,不谢
liangqin1573_30 回答时间:2016-10-10 12:17:57
NTC温度系数的测温效果不好呀!
mark0668 回答时间:2016-10-10 13:26:23
支持,支持!!

所属标签

STM32团队

意法半导体微控制器和微处理器拥有广泛的产品线,包含低成本的8位单片机和基于ARM® Cortex®-M0、M0+、M3、M4、M33、M7及A7内核并具备丰富外设选择的32位微控制器及微处理器


最新内容

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
微信公众号二维码 微信公众号
手机版二维码 手机版