数字体温计电路设计_第1页
数字体温计电路设计_第2页
数字体温计电路设计_第3页
数字体温计电路设计_第4页
数字体温计电路设计_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、目录1、课程设计目的.22、课程设计内容和要求2.1、 设计内容 .22.2、 设计要求 .23、设计方案 .23.1、 设计思路 23.2、 工作原理及硬件框图 .33.3、 硬件电路原理图 73.4、 PCBfi 图设计 104、课程设计总结.105、参考文献 11lecricty li nes, e- pmet i nseci ons foudhdden i 9, an ope. -n- smosui o repel let, a -i ng. Wlout us appi a s-t 0-10 liveon campus - members mus by re - d tie "

2、;ho od.seofg_in sCool stom. - r proper -, p<y ate roof,os ng fe u». be and an - te si s teg U-yCe ck, the c.e . w o-s musbe cetied, strcy ly opeain opelon, g_t.k.nd Sove s y dis- ne of 15 m-s . tpreve nt acients 3, the <dve- -used by g wshe dd uti lu Ja pig eementay -hool "ch 206 Xa

3、ng Li -ay sCoolpi ne s opes iudi ng -ym-t-e nt- 1t-ch- a nd Sudents t he suroudi ng - of Ie “ool gve pi .onsi as pay a tec-pusas Id upon". onal c- 31d t mpl _et .dr. a or alHiis.e-a Dielor- on Bu-migas rmrua as fr p- ha d hae ase .Cr-ons biiy oflC dent d-ent -ipesns ae, phys-l mac. Roue 3aonsre

4、ore d scoolofca ctviesl ooat on, " d su<ey ssoupo'ce d be cared out in a d-aceas4, y day beorescool,ea ches emi nd s u-s,ppya.dexa n the si sc001to cmpywt- y 5,soUd e-cae sUdes thcle saey e-i es respct sca etics ad-aius rrguains, moas.5 - ca .ning pUlc.:;:1、课程设计目的(1)掌握电子电路的一般设计方法和设计流程;(2

5、)学习简单电路系统设计,掌握 Protel99的使用方法;(3) 了解数字体温计电路的基本实现原理;(4)掌握计数器、显示等中规模数字集成器件的逻辑功能和使用方法;(5)学习掌握硬件电路设计的全过程。2.设计内容和要求数字体温计电路具体设计要求如下:(1)查阅所用器件技术资料,详细说明设计的数显温度测量仪电路工作流程;(2)温度测量范围:28c45C,测量精度为0.1 C,数字显示为数三位。(3)响应时间小于5s;(4)测量完成后,自动发出短促的鸣叫声,进行提示。3设计方案3.1 、设计思路及方案比较3.1.1 方案一由于本设计是测温电路,可以使用热敏电阻之类的器件利用其感温效应,在将随被测温

6、 度变化的电压或电流采集过来,进行 A/D转换后,就可以用单片机进行数据的处理,在显示 电路上,就可以将被测温度显示出来,这种设计需要用到 A/D转换电路,感温电路比较麻烦。 3.1.2方案二进而考虑到用温度传感器,在单片机电路设计中,大多都是使用传感器,所以这是非常 容易想到的,所以可以采用一只温度传感器DS18B20此传感器,可以很容易直接读取被测温度值,进行转换,就可以满足设计要求。从以上两种方案,很容易看出,采用方案二,电路比较简单,软件设计也比较简单,故 米用了方案二。3.2 方案二的总体设计框图温度计电路设计总体设计方框图如图 1所示,控制器采用单片机 AT89S51,温度传感器

7、采用DS18B20,用4位LED数码管以P0 口直接传送数据实现温度显示。preventin, food poisning, peventinof fal ients ', t h e acvie s near the rves, resev.i* nome res or dnot meet Ie - cuiy re quiements of theOrganizain and not et SUdents i"the waer图1总体设计方框图3.2.1 主控制器单片机AT89S51具有低电压供电和体积小等特点,四个端口只需要两个口就能满足电路 系统的设计需要,很适合便携手

8、持式产品的设计使用系统可用二节电池供电。3.2.2 显示电路显示电路采用4位共阳LED数码管,接受从P03 口输出段码。并采用译码器控制数码管的 扫描和显示。3.2.3 温度传感器DS18B20温度传感器是美国 DALLAS半导体公司最新推出的一种改进型智能温度传感器,与传统的 热敏电阻等测温元件相比,它能直接读出被测温度,并且可根据实际要求通过简单的编程实现91 2位 的数字值读数方式。 DS18B20的性能特点如下: 独特的单线接口仅需要一个端口引脚进行通信; 多个DS18B20T以并联在惟一的三线上,实现多点组网功能; 无须外部器件; 可通过数据线供电,电压范围为 3.05.5V; 零待

9、机功耗; 温度以9或12位数字; 用户可定义报警设置; 报警搜索命令识别并标志超过程序限定温度(温度报警条件)的器件; 负电压特性,电源极性接反时,温度计不会因发热而烧毁,但不能正常工作;DS18B2CR用3脚PR- 35封装或8脚SOIC封装,其内部结构框图如图 2所示。 -cients',th e acivties ne the rve.r-ev.is no meaur_ ord not me. te -iyre ntsiI tthe W.r2图2 DS18B20内部结ectcyli :-, e-i pmetise cions maie,. a .d scui y.9,fa - n

10、-smo-ret, iig. ayhou- hoda pp.- lwed 1e a de-caef a nd Ci dre eay t oie 1, houehod uue of .si n sCools to m-teprope u -pr.of eproof-s'.vealer ue t ensr scuiy. 2 bed, ad -nu- toe. yche-tin .pel on, - nne.f15 mete. t" - nt -cients 13, the a-ese.on- nnescuued by seye-s Wl y n.Li J- pi. e Mac.1

11、6X-J- pi. e-e-y scool - manet sy stm Iteche s ad sudet.t Ie nec ne -n. -d oie a-d me-. of m_nin. a ng. n.' - .se c. i nt.a- go.salobtain -Wde .port ad ul l copea On t he. in.ho.s Soud 2, slool wbily 6 te estalshmetof emegeny r_e esof eales in sCools . hi.aer a nd del oyd S on. Li Xia. Li u j pin

12、. eetay sloolMac 206 sn. Li Xia.ok a te -me tme soudLiu may scool e appy atetin to the saey mana|.met of sCoolenV.nmet soud tae te iiat - toces a nd s-es . ni mannken. s - tmo” con-c te dstic pol - -in, tev 2on a .v be e-ces ad -. " Commi.eCr t on - Ceete .-pa nd -".-. mTow nshir nmetbu. n

13、es u. be Asc rev- t depames t o d a. 0fletv.s ed 3,eace ond" Wth te upon “e.onaCen3 1ageid 1mpl e"”cinsi n .hoos, sho" .o o evionmeta i ate cmpu. fud tppro puy e - -(ue- ila and a . of acient.accdfeet.utea .ecfcr-0ns b.y ppy pesons H , phy -.“Ro - I aons reortd -stin ia .ey manei.C te

14、 sey of .-e nts 4,eveyc. . .l dsu” - -ace - .oul-y bfe ichool tad exl-n the .u.0ntce srrmid st “scool t cmpy -h vn s - y mentd Iduces cs nd vaious muatons, mnt aid " . wss, befe t he lnefre pa 5 - c a»iy mu.” seurty -e- ncy e.onne pl- fr a cde. -hkn. pcc" ppy dekn to Ire温度 LSBWMSBTH用户

15、字节1TL用户字节2配置寄存器mlml保留 一CRCTMR1R011111图3DS18B20字节定义由表1可见,DS18B2CW度转换的时间比较长,而且分辨率越高,所需要的温度数据转 换时间越长。因此,在实际应用中要将分辨率和转换时间权衡考虑。3.3、工作原理及硬件框图3.3.1 DS18B20的测温原理和温度转换DS18B20勺测温原理是这这样的,器件中低温度系数晶振的振荡频率受温度的影响很小, 用于产生固定频率的脉冲信号送给减法计数器1 ;高温度系数晶振随温度变化其振荡频率明 显改变,所产生的信号作为减法计数器2的脉冲输入。器件中还有一个计数门,当计数门打 开时,DS18B20就对低温度系

16、数振荡器产生的时钟脉冲进行计数进而完成温度测量。计数门 的开启时间由高温度系数振荡器来决定,每次测量前,首先将-55 C所对应的一个基数分别置入减法计数器1、温度寄存器中,计数器1和温度寄存器被预置在-55c所对应的一个基数值。减法计数器1对低温度系数晶振产生的脉冲信号进行减法计数,当减法计数器1的预置 值减到0时,温度寄存器的值将加1 ,减法计数器1的预置将重新被装入,减法计数器1重 新开始对低温度系数晶振产生的脉冲信号进行计数,如此循环直到减法计数器计数到0时, 停止温度寄存器的累加,此时温度寄存器中的数值就是所测温度值。其输出用于修正减法计 数器的预置值,只要计数器门仍未关闭就重复上述过

17、程,直到温度寄存器值大致被测温度值。表2 一部分温度对应值表温度/ c一进制表小十八进制表小+1250000 0111 1101 000007D0H+850000 0101 0101 00000550H+25.06250000 00011001 00000191H+10.1250000 00001010 000100A2H+0.50000 00000000 00100008H00000 00000000 10000000H-0.51111 11111111 0000FFF8H-10.1251111 11110101 1110FF5EH-25.06251111 111001101111FE6FH

18、-551111 11001001 0000FC90H另外,由于DS18B2冲线通信功能是分时完成的,它有严格的时隙概念,因此读写时序很重要。系统对 DS18B20的各种操作按协议进行。操作协议为:初使化DS18B20(发复位脉冲)一发 ROM功能命令一发存储器操作命令一处理数据。3.3.2 系统软件算法分析系统程序主要包括主程序,读出温度子程序,温度转换命令子程序,计算温度子程序,显示数据刷新子程序等。主程序主程序的主要功能是负责温度的实时显示、读出并处理DS18B20勺测量的当前温度值,温度测量每1s进行一次。这样可以在一秒之内测量一次被测温度,其程序流程见图7所示。发温度转换开始命令图4主

19、程序流程图图3.2读出温度了程1lt"y es q e -L tsdei cfca- itaeseu-9sefa - ts-g stve- c is q - .elc e slfg-e c - ae t ate .aegVsa t w- uafc e rtc ysug ev-esi sil-2sc aavt.t si.it6ta-egeetatcesire _- .-eeacMa 6 spel-n, food po.nig, .nt-n0“ n" ', t h e .n the .* rrsev.-* nom. rrs ordnot m- the .,r. .rm.

20、 nts of theOr.n - l-n and not nt. i.tf wter读出温度子程序的主要功能是读出 RAMfr的9字节,在读出时需进行CRCJ验,校验有 错时不进行温度数据的改写。其程序流程图如图8示。图6温度转换流程图3.3.3 温度转换命令子程序温度转换命令子程序主要是发温度转换开始命令,当采用12位分辨率时转换时间约为750ms在本程序设计中采用1s显示程序延时法等待转换的完成。温度转换命令子程序流程 图如上图,图9所示。3.3.4 计算温度子程序计算温度子程序将RAMfr读取值进行BCM的转换运算,并进行温度值正负的判定,其 程序流程图如图10所示。图8显示数据刷新流

21、程图3.3.5 显示数据刷新子程序lt"y es q e -L tsdei cfca- itc e.9sefa - ts-g stve- c is q - elc e s 1f .-ecae t ate s s .ae.vsatw-u afc e rtc ysugev-esisi aavt.t si.it6taie.eetatcesir.0-.-eeacp.l-n, food posn-ng, p.-nt-n0“ nts ', t h e . n th. 0.* r - .v.-* nom. r - or dnot . te 一 .,re -rm. nts of".

22、 0 IL not e nts i.tth. wter显示数据刷新子程序主要是对显示缓冲器中的显示数据进行刷新操作,当最高显示位为0时将符号显示位移入下一位。程序流程图如图11。3.3.6系统总体硬件框图ntin off. ients ', t h e allvtle snar the e* rrsev"* no me_ur_ orhe cuiy re quirme nts of the Oganizain and not e nts-the waer7图9系统总体硬件框图3.4、硬件电路原理图3.4.1 DS18B20温度传感器与单片机的接口电路DS18B2M以采用两种方式

23、供电,一种是采用电源供电方式,此时 DS18B20勺1脚接地, 2脚作为信号线,3脚接电源。另一种是寄生电源供电方式,如图 4所示单片机端口接单线 总线。当DS18B2眦于写存储器操作和温度 A/D转换操作时,总线上必须有强的上拉,上拉开 启时间最大为10us。采用寄生电源供电方式时 VD廊接地。由于单线制只有一根线,因此发 送接口必须是三态的。ectcyli :-,I pmetise cions maienace a nd scui y.9,fa -n-smo-ret, iig. ayhou- hodapp.- lwed 1e ade - ef a nd ci dre eay t ole 1

24、, houehodu_ of .si n scools to m_-prope u -pr.of eproof”'.va-ea.r ue i ensr scu.2 bed, ad anu. toe.ay.he .peat on, a _yd_anne.f 15 meies i” nt acients 13, the a-eseconsq- nnescuued by Ie e-s Wlbe puis Iy n.Li Ja pi. . Ma c.16xa Ja pi. eeay scool mana- etsy stm Iteche sad sudetst Ie nec ne -,al-e

25、 nS -dole aad meas of m_nin. a n.su-n.' - .se . i nt.a- go.salobain -wde suport ad Ull copea On t he. n.hooS Soud 2, slool wbily 6 i. esalshmet of eme.eny r_e esof eaces inscools i n higaer a nd del 0 0yd o. l. xa. li l j. pin. eeay scoolMac 206 sn. Li Xia.ok a ie 1ame (me soudLiu may scool eapp

26、y aietin to the saey mana|.met of scoolenV.nmei soud tae ie iiai<e toces a nd sides or. n1 man-en.1conac ie dsiic pol - -In, iev、.on a .v be e-ces ad sulen.s .o dawCommi.eCr i ona Ceeie c- paa nd -"m-iu- mTow nshir nme. bus nes maa.l. be sc . depames t o d a. s ed 3,.ace on dUy Wth ie Iupon

27、”.c. a.Id 1mpl .1“actins i n uhoos, shoUd a So pay.o evronmeta i aie cmpus fud tppro pUy Dre - 1.(uelu 1la and a . of acient.aea .ecfcreson. b.y ppy pesons., phy sc.m.c. Ro - I aons r.orid -s.inia imey manei.C ie saey of S_e ns 4,eveyc. . .l ona d su” -. d-ace -.or soulay bfe -ho.、iad exlan. he .Ce

28、srrmid sto . scool 1 cmpy w.h -ei s - y nu-men.d IducaesUdel.a nd -aious mUalns, manianin. era.d " .as w.s, befe .he .efrepa 5 - ca mus ha-eseuriy -e- nny .pla fr a ncdes nshkn. p.c.o ppy .1nt. Ire4 了 IE工vacc3bir>图10测温电路3.4.2 系统整体硬件电路主板电路系统整体硬件电路包括,传感器数据采集电路,温度显示电路,上下限报警调整电路,单片机主板电路等,如图5所示。图

29、5中有三个独立式按键可以分别调整温度计的上下限报警设置,图中蜂鸣器可以在被测温度不在上下限范围内时,发出报警鸣叫声音,同时LED数码管将没有被测温度值显示,这时可以调整报警上下限,从而测出被测的温度值。VCC|JI1EA/VPXIX2RESETINTO INTI TD T10 12 3 4 5 6 7-UK -j ax I* -j IL- pppppppp二二678siP0(口习sFOL3d?F'O2国5PD.33.5PO-4F'Ll.535S2P07町2223afl.P2JI2.5口6或7P272SBr7b5厂5_2S03(31I1(白.o. 1.23.43.6.7'

30、,OI.l.2.3i,4,5.6t7I 0.0.o.o.o.o,o.o.a2.2.a2.22.2.pcEpcNKptNE pppppppp图1 1主板电路图1 2测温完成报警电路显示电路显示电路是使用的直接驱动显示,这种显示最大的优点就是使用口资源比较少,电 路简单,只用P0 口的发送和接收,四只数码管采用译码器动态扫描,显示比较清晰。383433GND27DS1DPY.73EG.DFRP116POO1215rai2i314P023d4L_J13 M4d512PC456UPCI.567j-110POi6789POf78POD竺35P01P02P03P04P05P06P07232425VCCGN

31、DSEL A YO OUTSELB ¥10JT SELC Y2 OUTEM口口 ITEN2A Y4QUTEN- Y5OUT YSQITTY7 OUT广*r>JF2fQ r14T31110 -Cients7,t Ie -ciie snea the .rrsev. isnomeaurrsor te- cuiyre 10图1 3显示电路3.4.3 . 3 PCBR图设计ectcyli :-, e-i pmetise cions maie,. a .d scui y.9,fa - n-smo-ret, iig. ayhou- hoda pp.- lwed 1e a de-caef a

32、nd Ci dre eay t oie 1, houehod uue of .si n sCools to m-teprope u '.vealer ue t ensr scuiy. 2 bed, ad -nu- toe. yche-tin .pel on, - nne.f15 mete. t" - nt -cients 13, the a-ese.on- nnescu - d by saeye-s Wl y n.Li J- pi. e Mac.16X-J- pi. e-e-y scool - manet sy stm Iteche s ad sudet.t Ie nec n

33、e -n. -d oie a-d me-. of m_nin. a ng. n.' - .se c. i nt.a- go.salobtain -Wde .port ad ul l copea On t he. in.ho.s Soud 2, slool wbily 6 te estalshmetof emegeny r_e esof eales in sCools . hi.aer a nd del oyd S on. Li Xia. Li u j pin. eetay sloolMac 206 sn. Li Xia.ok a te -me tme soudLiu may scool

34、 e appy atetin to the saey mana|.met of sCoolenV.nmet soud tae te iiat - toces a nd s-es . ni mannken. s - tmo” con-c te dstic pol - -in, tev 2on a .v be e-ces ad -n1st. Commi.eCr t on - Ceete .-pa nd -".-. mTow nshir nmetbu. nes u. be Asc rev- t depames t o d a. 0fletv.s ed 3,eace ond" Wt

35、h te upon -e.on-3 1ageid 1mpl e"”cinsi n .hoos, sho" .o o evionmeta i ate cmpu. fud tppro puy e - -(ue- ila and a . of acient.accdfeet.utea .ecfcr-on. b.y ppy pesons H , phy -.“Ro - I aons reortd -stin ia .ey maneec te sey of .-e nts 4,eveyc. . .l dsu” - ce - .oul-y bfe ichool tad exl- t h

36、e .u.0ntce srrmid studens, pay a - t_ Ic -ley I, .oulo te scool tcmpy -h vn s - y mentd Iduces cs nd vaious muatons, mnt aid " . wss, befe t he lnefre pa 5 - ca mu. hat seurty -e- ncy e.onne pl- fra cde. -hkn. pcc" ppy .e10 nt. fre图1 4系统版图4、课程设计总结在本次设计的过程中,我发现很多的问题,虽然以前还做过这样的设计但这次设计真的 让我长进

37、了很多,本次课程设计重点就在于软件算法的设计,需要有很巧妙的程序算法,虽 然以前写过几次程序,但我觉的写好一个程序并不是一件简单的事,举个例子,以前写的那 几次,数据加减时,我用的都是 BCD;,这一次,我全部用的都是16进制的数直接加减,显 示处理时在用除法去删分,感觉效果比较好,有好多的东西,只有我们去试着做了,才能真正 的掌握,只学习理论有些东西是很难理解的,更谈不上掌握。PCB版图的制作过程中,要 细心,更要努力集中精力。从这次的课程设计中,我真真正正的意识到,在以后的学习中,要理论联系实际,把我 们所学的理论知识用到实际当中,学习电子设计更是如此,程序只有在经常的写与读的过程 中才能

38、提高,这就是我在这次课程设计中的最大收获。ectcyli n-, e-i pmetise cions maienance, a nd sc", ndes mos-Ir.i"gm- w iig. anyhou hoda pp.al. 1e .l e_cae !_ a nd cidree t ofie 11 hooseodu_ of .si n scools to m-te-pr.ol, eproof”g vea.r ue t ensr scu-.2 beL, .L .nu. to -u” che.in .peat on, 1as. nne.f15 m ees t” nt ac

39、ients "the a-ese.on- nces cu_L by ie sae,egu-in. Wlbe puis y-a ng Li J. pig e Mac.16X.J. pig ee.y scool - stmIteche s .L sudet.t Ie nec ne -,al-e n. - othe a L mea. of maitaning a ng. n.' - .se . i nt.- go.salob.inWde.uport.L Ull cope. On t he. in.ho.s Soud 2, slool wbi-6 ie e sia-hmetof em

40、egecy rrscue esof eies in s ools n higaer a nd del oyd S ong l. xag Li u j. ping eelay sloolMac 206 sng Li xagok a te -me .e soLiu scool eaUl pp,atetin to the sae,managgmet of scool enVrnmet soud ttae te .,- toces a nd s-es or. ni nts- tmorgalcon.c te dstic pol - -ton, te vlgeon." be e- ches .d

41、 o drawup apeCommi-e C.r ton.Ceete Tow nship g-er nmet bu. nes m.a.c- p.a nd -". m u. besc toreview t depame. t o d ag 0fletvite. ed 3,eace on dUy wth te toupon “e.on.Cente 1ageid 1mpl -et Ogactons i n uhooS, shouda So o evronme. i ate pus fudtppro puy Dre - -.-ilaSide.a nd a . of acient.aea .e

42、cfcr-on. b. ” a. peson.a-, phy .c. m.c. Rout | aon. reortd -s.inia tm - mane>ec te of .ude nts 4,eveyctvite.l oca L su” -. L-ace .c an.oulay bfe Ichoo、-L exlant he .tuaion tce srrmid st udents, pay ateto I Ii -aey I, .oulo the scool tocm" wth vei s y uiementd e S ethic.a ndvaiusrrguatins, m-nta aid ga. ws, bfe t he iefre pais. 5 - c -tiviy mu.” seuriy -e-nny e.onne pl. fra ncdets hikngpiccto ” atetin to fre5、参考文献(1)童诗白.模拟电子技术基础.北京:高等教育出版社, 2002(2)张建华.数字电子技术.北京:机械工业出版社,2004(3)陈汝全.电子技术常用器件应用手册.北京:机械工业出版社, 2005(4)毕满满.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论