📄 用普通单片机实现极简单的测温电路(原创).htm
字号:
<LI
style="FONT-SIZE: 16px; COLOR: #11779f; BORDER-BOTTOM: #e7e8ea 1px dotted"><IMG
src="用普通单片机实现极简单的测温电路(原创).files/sw_top_menu_org.gif"
align=absMiddle> <B>用普通单片机实现极简单的测温电路(原创)</B>
<LI style="COLOR: gray">标签: 分类: 更新日期:2006-04-01 11:24
<LI style="FONT-SIZE: 14px">利用单片机实现极简单的测温电路
<BR>单片机在电子产品中的应用已经越来越广泛,在很多的电子产品中也用到了温度检测和温度控制,但那些温度检测与控制电路通常较复杂,成本也高,本文提供了一种低成本的利用单片机多余I/O口实现的温度检测电路,该电路非常简单,且易于实现,并且适用于几乎所有类型的单片机.其电路如下图所示:
<BR><IMG onmousewheel="return imgzoom(this);"
onclick="if(!this.resized) {return true;} else {window.open('u/40/1143861722.jpg');}"
src="用普通单片机实现极简单的测温电路(原创).files/1143861722.jpg"
onload="if(this.width>500) {this.resized=true; this.width=500; this.alt='这是一张缩略图,点击可放大。\n按住CTRL,滚动鼠标滚轮可自由缩放';this.style.cursor='hand'}">
<BR>图中: <BR>P1.0、P1.1和P1.2是单片机的3个I/O脚; <BR>RK为100k的精密电阻;
<BR>RT为100K-精度为1%的热敏电阻; <BR>R1为100Ω的普通电阻; <BR>C1为0.1μ的瓷介电容. <BR>其工作原理为:
<BR>1.先将P1.0、P1.1、P1.2都设为低电平输出,使C1放电至放完.
<BR>2.将P1.1、P1.2设置为输入状态,P1.0设为高电平输出,通过RK电阻对C1充电,单片机内部计时器清零并开始计时,检测P1.2口状态,当P1.2口检测为高电平时,即C1上的电压达到单片机高电平输入的门嵌电压时,单片机计时器记录下从开始充电到P1.2口转变为高电平的时间T1.
<BR>3.将P1.0、P1.1、P1.2都设为低电平输出,使C1放电至放完.
<BR>4.再将P1.0、P1.2设置为输入状态,P1.1设为高电平输出,通过RT电阻对C1充电,单片机内部计时器清零并开始计时,检测P1.2口状态,当P1.2口检测为高电平时,单片机计时器记录下从开始充电到P1.2口转变为高电平的时间T2.
<BR>5.从电容的电压公式: <BR><IMG onmousewheel="return imgzoom(this);"
onclick="if(!this.resized) {return true;} else {window.open('u/40/1143861756.jpg');}"
src="用普通单片机实现极简单的测温电路(原创).files/1143861756.jpg"
onload="if(this.width>500) {this.resized=true; this.width=500; this.alt='这是一张缩略图,点击可放大。\n按住CTRL,滚动鼠标滚轮可自由缩放';this.style.cursor='hand'}">
<BR>可以得到:T1/RK=T2/RT,即 RT=T2×RK/T1
<BR>通过单片机计算得到热敏电阻RT的阻值.并通过查表法可以得到温度值.
<BR>从上面所述可以看出,该测温电路的误差来源于这几个方面:单片机的定时器精度,RK电阻的精度,热敏电阻RT的精度,而与单片机的输出电压值、门嵌电压值、电容精度无关.因此,适当选取热敏电阻和精密电阻的精度,单片机的工作频率够高,就可以得到较好的测温精度.
<BR>当单片机选用4M工作频率,RK、RT均为1%精度的电阻时,温度误差可以做到小于1℃.
<BR>如果P1.2具有外部上升沿中断的功能,程序可以更简单,效果更好. <BR>单片机工作的程序流程图如下: <BR><IMG
onmousewheel="return imgzoom(this);"
onclick="if(!this.resized) {return true;} else {window.open('u/40/1143861847.jpg');}"
src="用普通单片机实现极简单的测温电路(原创).files/1143861847.jpg"
onload="if(this.width>500) {this.resized=true; this.width=500; this.alt='这是一张缩略图,点击可放大。\n按住CTRL,滚动鼠标滚轮可自由缩放';this.style.cursor='hand'}">
<LI style="PADDING-RIGHT: 10px; COLOR: #11779f; TEXT-ALIGN: right">阅读:(<SPAN
style="FONT-SIZE: 10px">1431</SPAN>) 评论:(<SPAN
style="FONT-SIZE: 10px">7</SPAN>)</LI></UL></DIV></DIV>
<DIV class=body_mr_title style="MARGIN-TOP: 10px">评论</DIV>
<DIV class=comm_box>
<DIV class=comm_img_box><IMG height=96
src="用普通单片机实现极简单的测温电路(原创).files/member_icon.gif" width=96></DIV>
<DIV class=comm>
<UL>
<LI><A name=2262></A>网友:电源网网友 IP:<SPAN
style="FONT-SIZE: 10px"></SPAN> 发表于:<SPAN
style="FONT-SIZE: 10px">2006-04-26 17:31</SPAN>
<LI>其实DS18B20的应用也不复杂,精度高多了</LI></UL></DIV></DIV>
<DIV class=comm_box>
<DIV class=comm_img_box><A href="http://azhu.blog.dianyuan.com/"
target=_blank><IMG height=96
src="用普通单片机实现极简单的测温电路(原创).files/7f39f8317fbdb1988ef4c628eba02591.jpg"
width=96></A></DIV>
<DIV class=comm>
<UL>
<LI><A name=2266></A>网友:<A class=lk1
href="http://azhu.blog.dianyuan.com/">azhu</A> IP:<SPAN
style="FONT-SIZE: 10px"></SPAN> 发表于:<SPAN
style="FONT-SIZE: 10px">2006-04-26 17:44</SPAN>
<LI>:) 你说的在理.这个电路并不适合只做温度测量用.
上面的这个电路适用于单片机有多余资源,而又需要做不精确的温度测量的场合.</LI></UL></DIV></DIV>
<DIV class=comm_box>
<DIV class=comm_img_box><A href="http://chaoshengbo.blog.dianyuan.com/"
target=_blank><IMG height=96
src="用普通单片机实现极简单的测温电路(原创).files/e6cb2a3c14431b55aa50c06529eaa21b.gif"
width=96></A></DIV>
<DIV class=comm>
<UL>
<LI><A name=2911></A>网友:<A class=lk1
href="http://chaoshengbo.blog.dianyuan.com/">makesoft</A> IP:<SPAN
style="FONT-SIZE: 10px"></SPAN> 发表于:<SPAN
style="FONT-SIZE: 10px">2006-05-06 10:26</SPAN>
<LI>这个电路也许只能是单片机任务不忙时使用,要是响应中断的话,精度就差多了</LI></UL></DIV></DIV>
<DIV class=comm_box>
<DIV class=comm_img_box><A href="http://azhu.blog.dianyuan.com/"
target=_blank><IMG height=96
src="用普通单片机实现极简单的测温电路(原创).files/7f39f8317fbdb1988ef4c628eba02591.jpg"
width=96></A></DIV>
<DIV class=comm>
<UL>
<LI><A name=3013></A>网友:<A class=lk1
href="http://azhu.blog.dianyuan.com/">azhu</A> IP:<SPAN
style="FONT-SIZE: 10px"></SPAN> 发表于:<SPAN
style="FONT-SIZE: 10px">2006-05-08 09:23</SPAN>
<LI>确实如楼上所言.</LI></UL></DIV></DIV>
<DIV class=comm_box>
<DIV class=comm_img_box><A href="http://kkai008.blog.dianyuan.com/"
target=_blank><IMG height=96 src="用普通单片机实现极简单的测温电路(原创).files/member_icon.gif"
width=96></A></DIV>
<DIV class=comm>
<UL>
<LI><A name=10186></A>网友:<A class=lk1
href="http://kkai008.blog.dianyuan.com/">kkai008</A> IP:<SPAN
style="FONT-SIZE: 10px"></SPAN> 发表于:<SPAN
style="FONT-SIZE: 10px">2006-07-20 22:38</SPAN>
<LI>不错,充分利用资源,简单,可行</LI></UL></DIV></DIV>
<DIV class=comm_box>
<DIV class=comm_img_box><IMG height=96
src="用普通单片机实现极简单的测温电路(原创).files/member_icon.gif" width=96></DIV>
<DIV class=comm>
<UL>
<LI><A name=20589></A>网友:电源网网友 IP:<SPAN
style="FONT-SIZE: 10px"></SPAN> 发表于:<SPAN
style="FONT-SIZE: 10px">2006-11-16 00:10</SPAN>
<LI>不准,误差很大!</LI></UL></DIV></DIV>
<DIV class=comm_box>
<DIV class=comm_img_box><IMG height=96
src="用普通单片机实现极简单的测温电路(原创).files/member_icon.gif" width=96></DIV>
<DIV class=comm>
<UL>
<LI><A name=38667></A>网友:电源网网友 IP:<SPAN
style="FONT-SIZE: 10px"></SPAN> 发表于:<SPAN
style="FONT-SIZE: 10px">2007-06-27 18:35</SPAN>
<LI>非常感谢</LI></UL></DIV></DIV>
<DIV class=page><FONT color=#a90a08>1</FONT></A> </DIV>
<DIV class=body_mr_title style="MARGIN-TOP: 10px">发表评论</DIV>
<DIV class=body_mr_body>
<TABLE class=fm_tb cellSpacing=0 cellPadding=0 align=center>
<FORM name=f onsubmit="return c_f();" action=comment_deal.php method=post>
<TBODY>
<TR>
<TD>发表状态:<INPUT id=send1 onclick=isLogin(1); type=radio CHECKED value=1
name=send>登录发表 <INPUT id=send2 onclick=isLogin(2); type=radio
value=2 name=send>匿名发表 </TD></TR>
<TR id=s>
<TD>用户名:<INPUT class=txt id=name size=18 name=name> 密码:<INPUT
class=txt id='\pw"' type=password size=22 name=pw></TD></TR>
<TR id=h style="DISPLAY: none">
<TD>用户名:<INPUT id=name disabled size=28 value=电源网网友 name=name></TD></TR>
<TR>
<TD>评论内容:</TD></TR>
<TR>
<TD><TEXTAREA class=area id=conetnt name=content></TEXTAREA></TD></TR>
<TR>
<TD><INPUT id=sub type=submit value=发表评论 name=sub> <INPUT id=rewrite type=reset value=重新填写 name=rewrite> </TD></TR><INPUT
id=hd_name type=hidden name=hd_name> <INPUT id=blog_id type=hidden value=61
name=blog_id> <INPUT id=arti_id type=hidden value=623 name=arti_id> <INPUT
id=author_id type=hidden value=1126 name=author_id> <INPUT id=total
type=hidden value=7 name=total> <INPUT id=flag type=hidden value=azhu
name=flag> </FORM></TBODY></TABLE></DIV></DIV></DIV></DIV><BR></DIV>
<SCRIPT>
function c_f()
{
if (document.getElementById("send1").checked == true)
{
if (trim(document.getElementById("name").value) == "")
{
alert("请填写您的用户名");document.getElementById("name").focus();return false;
}
if (trim(document.getElementById("pw").value) == "")
{
alert("请填写您的密码");document.getElementById("pw").focus();return false;
}
}
if (trim(document.getElementById("content").value) == "")
{
alert("请填写评论内容");document.getElementById("content").focus();return false;
}
document.getElementById("sub").disabled = true;
}
function isLogin(i)
{
if (i == 1)
{
document.getElementById("s").style.display = 'block';
document.getElementById("h").style.display = 'none';
} else
{
document.getElementById("s").style.display = 'none';
document.getElementById("h").style.display = 'block';
}
}
</SCRIPT>
<DIV class=footer>
<UL>
<LI class=spacing><A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>电源网在线客服</A> 客服电话:022-58392381
<LI><A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>关于网博</A> | <A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>服务条款</A> | <A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>广告服务</A> | <A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>联系我们</A> | <A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>法律声明</A> | <A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>诚邀加盟</A> | <A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>诚信会员</A> | <A class=lk3u
href="http://azhu.blog.dianyuan.com/article.php?arti_id=623#"
target=blank>网站导航</A>
<LI>Copyright 2002 - 2008 dianyuan Corporation. All Rights Reserved
<LI>网博公司 版权所有 </LI></UL></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -