




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
.z基于單片機的多功能溫度檢測系統(tǒng)的設(shè)計引言
隨著社會的開展和技術(shù)的進步,人們越來越注重溫度檢測與顯示的重要性。溫度檢測與狀態(tài)顯示技術(shù)與設(shè)備已經(jīng)普遍應(yīng)用于各行各業(yè),市場上的產(chǎn)品層出不窮。溫度檢測及顯示也逐漸采用自動化控制技術(shù)來實現(xiàn)監(jiān)控。本課題就是一個溫度檢測及狀態(tài)顯示的監(jiān)控系統(tǒng)。二、系統(tǒng)方案
本系統(tǒng)采用AT89S52作為該系統(tǒng)的單片機。系統(tǒng)整體硬件電路包括,電源電路,傳感器電路,溫度顯示電路,上下限報警電路等如圖1所示。圖中報警電路可以在被測溫度不在上下限*圍內(nèi)時,發(fā)出報警鳴叫聲音。溫度控制的根本原理為:當(dāng)DSl8B20采集到溫度信號后,將溫度信號送至AT89S52中處理,同時將溫度送到LCD液晶屏顯示,單片機根據(jù)初始化設(shè)置的溫度上下限進展判斷處理,即如果溫度大于所設(shè)的最高溫度就啟動風(fēng)扇降溫;如果溫度小于所設(shè)定的最低溫度就啟動報警裝置。溫度控制器的原理圖二三、系統(tǒng)硬件設(shè)計1.單片機AT89S52的介紹
AT89S52是一種低功耗、高性能CMOS8位微控制器,具有8K可編Flash存儲器。使用Atmel公司高密度非易失性存儲器技術(shù)制造,與工業(yè)80C51產(chǎn)品指令和引腳完全兼容。片上Flash允許程序存儲器在系統(tǒng)編程,亦適于常規(guī)編程器。在單芯片上,擁有靈巧的8位CPU和在系統(tǒng)可編程Flash,使AT89S52為眾多嵌入式控制應(yīng)用系統(tǒng)提供高靈活、超有效的解決方案[5]。AT89S52具有以下標(biāo)準功能:8k字節(jié)Flash,256字節(jié)RAM,32位I/O口線,看門狗定時器,2個數(shù)據(jù)指針,三個16位定時器/計數(shù)器,一個6向量2級中斷構(gòu)造,全雙工串行口,片內(nèi)晶振及時鐘電路。另外,AT89S52可降至0Hz靜態(tài)邏輯操作,支持2種軟件可選擇節(jié)電模式??臻e模式下,CPU停頓工作,允許RAM、定時器/計數(shù)器、串口、中斷繼續(xù)工作。掉電保護方式下,RAM內(nèi)容被保存,振蕩器被凍結(jié),單片機一切工作停頓,直到下一個中斷或硬件復(fù)位為止。
2.DS18B20傳感器的介紹
在傳統(tǒng)的模擬信號遠距離溫度測量系統(tǒng)中,需要很好的解決引線誤差補償問題、多點測量切換誤差問題和放大電路零點漂移誤差問題等技術(shù)問題,才能夠到達較高的測量精度。另外一般監(jiān)控現(xiàn)場的電磁環(huán)境都非常惡劣,各種干擾信號較強,模擬溫度信號容易受到干擾而產(chǎn)生測量誤差,影響測量精度[5]。因此,在溫度測量系統(tǒng)中,采用抗干擾能力強的新型數(shù)字溫度傳感器是解決這些問題的最有效方案,與其它溫度傳感器相比DSl820具有以下特點:
(1)獨特的單線接口方式。DSl820在與微處理器連接時僅需要一條接口線即可實現(xiàn)微處理器與DSl820的雙向通訊。(2)多點功能簡化了分布式溫度檢測的應(yīng)用。(3)DSl820在使用中無需任何外圍元件。(4)可用數(shù)據(jù)線供電,電壓*圍從3.0V到5.5V。(5)可測量的溫度*圍從-55℃到+125℃,增量值0.5℃;華氏溫度*圍從-67到+257,增量值0.9。(6)支持多點組網(wǎng)功能。多個DS1820可以并接在同一條總線上,實現(xiàn)多點測溫。(7)9位的溫度分辨率。測量結(jié)果以9位數(shù)字量方式串行傳送。(8)用戶可設(shè)定溫度報警門限值。(9)有超溫度搜尋功能。
〔1〕DSl8B20的工作原理
DS18B20的內(nèi)部構(gòu)造DSl8B20的測溫原理框圖如圖3.2所示。圖中低溫度系數(shù)品振的振蕩頻率受溫度影響很小,用于產(chǎn)生同定頻率的脈沖信號送給計數(shù)器l。高溫度系數(shù)晶振隨溫度變化其振蕩頻率明顯改變。所產(chǎn)生的信號作為計數(shù)器2的脈沖輸入。計數(shù)器1、計數(shù)器2和溫度存放器被預(yù)置在-55℃所對應(yīng)的一個基數(shù)值。計數(shù)器l對低溫度系數(shù)晶振產(chǎn)生的脈沖信號進展減法計數(shù),當(dāng)計數(shù)器1的預(yù)置值減到O時,溫度計數(shù)器的值將加l,計數(shù)器l的預(yù)置值將被重新裝人,計數(shù)器l重新開場對低溫度系數(shù)晶振產(chǎn)生的脈沖信號進展計數(shù),如此循環(huán)直到計數(shù)器2計數(shù)到O時,停頓溫度存放器的累加,此時溫度存放器中的數(shù)值即為所測溫度。圖3.2中的斜率累加器用于補償和修正測溫過程中的非線性,其輸出小于修正計數(shù)器l的預(yù)置值。
〔2〕DS18B20與AT89S52的接口方式
DS18B20與單片機的連接方式有兩種:即寄生電源方式和外部電源方式。
寄生電源方式:在寄生電源供電方式下,DS18B20從單線信號線上汲取能量:在信號線DQ處于高電平期間把能量儲存在內(nèi)部電容里,在信號線處于低電平期間消耗電容上的電能工作,直到高電平到來再給寄生電源〔電容〕充電。寄生電源方式有三個好處:1〕進展遠距離測溫時,無需本地電源。2〕可以在沒有常規(guī)電源的條件下讀取ROM。3〕電路更加簡潔,僅用一根I/O口實現(xiàn)測溫。要想使DS18B20進展準確的溫度轉(zhuǎn)換,I/O線必須保證在溫度轉(zhuǎn)換期間提供足夠的能量,由于每個DS18B20在溫度轉(zhuǎn)換期間工作電流到達1mA,當(dāng)幾個溫度傳感器掛在同一根I/O線上進展多點測溫時,只靠4.7K上拉電阻就無法提供足夠的能量,會造成無法轉(zhuǎn)換溫度或溫度誤差極大。
外部電源供電方式:在外部電源供電方式下,DS18B20工作電源由VDD引腳接入,此時I/O線不需要強上拉,不存在電源電流缺乏的問題,可以保證轉(zhuǎn)換精度,同時在總線上理論可以掛接任意多個DS18B20傳感器,組成多點測溫系統(tǒng)。
本系統(tǒng)采用外部電源方式。連接方法即DS18B20的1腳接地,2腳(DQ引腳)與AT89S52的一根I/O口線相連,3腳接+5V。在A89S52的I/O口線與+5V之間連接一4.7K的上拉電阻,以保證數(shù)據(jù)采集的正常進展。假設(shè)要組成多點溫度檢測系統(tǒng),可在單片機的同一根I/O口線上,以一樣的連接方法并聯(lián)多片DS18B20芯片。
3、LCD1602液晶屏
1602液晶顯示模塊可以和單片機AT89S52直接接口。4、蜂鳴器驅(qū)動電路
由于蜂鳴器的工作電流一般比較大,以致于單片機的I/O口是無法直接驅(qū)動的,所以要利用放大電路來驅(qū)動,一般使用三極管來放大電流就可以了。當(dāng)所測的溫度低于6攝氏度時,報警。
5、風(fēng)扇電路
當(dāng)所測的溫度高于80攝氏度時,啟動風(fēng)扇電路。因為工作電流比較大,所以用放大電路來驅(qū)動,即用三極管來放大電流就可以了。當(dāng)溫度高于80℃時,給單片機一個命令,單片機P2.6引腳輸出高電平,三極管導(dǎo)通,風(fēng)扇電路接通,電風(fēng)扇開場轉(zhuǎn)動,從而起到降溫作用。
四、系統(tǒng)的軟件設(shè)計
本系統(tǒng)采用AT89S52作為核心處理器件,把經(jīng)過DSl8B20現(xiàn)場實時采集到的溫度數(shù)據(jù),存入AT89S52的內(nèi)部數(shù)據(jù)存儲器,送液晶顯示,并與預(yù)先設(shè)定值進展比較,然后由單片機輸出信號去控制風(fēng)扇電路和報警電路。多功能溫度檢測顯示系統(tǒng)軟件主要包括:函數(shù)聲明、延遲時間函數(shù)、DS18B20初始化函數(shù)、讀出DS18B20當(dāng)前的溫度、溫度數(shù)據(jù)轉(zhuǎn)化成液晶字符顯示等程序。五、小結(jié)
隨著工業(yè)的不斷開展,對溫度測量的要求來越高,而且測量*圍也越來越廣,因此對溫度檢測技術(shù)的要求也越來越高。
本文介紹了以DSl8B20新型數(shù)字溫度傳感器、AT89S52單片機、LCD1602液晶顯示模塊為主體構(gòu)建的溫度檢測顯示系統(tǒng)。說明了系統(tǒng)硬件電路、系統(tǒng)主程序與各模塊子程序的設(shè)計。本系統(tǒng)采用的是DALLAS公司推出的數(shù)字式溫度傳感器DS18B20,無需外加A/D即可輸出數(shù)字量,把溫度信號直接轉(zhuǎn)換成串行數(shù)字信號供微機處理。因此。該系統(tǒng)具有硬件電路構(gòu)造簡單、轉(zhuǎn)換精度高、顯示結(jié)果清晰穩(wěn)定、本錢低等顯著優(yōu)點。在諸如糧庫測溫、智能建筑、中央空調(diào)等多種需要溫度檢測的場合具有較好的應(yīng)用前景。BasedonSCMmulti-functionaltemperaturetestingsystemdesign1、prefaceWiththedevelopmentofsocietyandthetechnologicalprogress,peoplepaymoreandmoreattentiontotheimportanceoftemperaturedetectionanddisplay.Temperaturedetectionandstatusdisplaytechnologyandequipmenthasbeenwidelyappliedinindustries,productsonthemarketemergeinendlessly.Temperaturetestingandalsograduallyadopttheautomaticcontroltechnologytorealizethemonitor.Thistopicisatemperaturetestingandstatusofthemonitoringsystem.2、SystemsolutionsThissystemUSESthemonolithicintegratedcircuitAT89S52asthissystem.Thewholesystem,thehardwarecircuitincludingpowersupplycircuit,sensor,thetemperaturedisplaycircuitcircuit,upperalarmcircuitsuchasshowninfigure1.Figureinthealarmingcircuitcanbemeasuredinuppertemperaturerange,screamingvoicealarm.ThebasicprincipleforthetemperaturecontrolDSl8B20:whenthetemperaturesignalacquisitiontoaftertemperaturesignalsenttohandle,AT89S52temperaturetoLCDscreen,SCMaccordingtoinitializetheuppertemperaturesetting,namely,ifthejudgementoftemperaturethanthehighesttemperaturecoolingfanisstarted,Ifthetemperatureislessthanthelowesttemperaturesettingonalarmdevice.Temperaturecontrollerdiagram3、Thesystemhardwaredesign〔1〕AT89S52SCMareintroducedAT89S52devicesisalowpowerconsumption,highCMOS8bitmicro-controller,8KprogrammableFlashmemory.UseAtmelpanyhigh-densitynonvolatilestoragetechnology,andindustrial80C51productinstructionandpinfullypatible.TheFlashmemorychipsallowsprogramsinsystemprogramming,alsosuitableforconventionalprogramming.Inasinglechip,haveclever8bitsCPUandprogrammableFlashinthesystem,formanyembeddedcontrolAT89S52applicationsystemprovidesahighlyfle*ible,efficientsolutions[5].AT89S52hasthefollowingfunctions:thestandard256bytes,8kbyteFlashRAM,32I/Oport,thewatchdogtimer,2data,threepointer16timer/counter,a6vectorlevel2interruptstructure,full-duple*serial,timelyclockcircuitwithincrystals.Inaddition,0HzAT89S52candroptothestaticlogicoperation,supporttwosoftwarecanchoosepowersavingmode.Idlemode,theCPUtostopworking,andallowstheRAM,timer/counters,serial,continuetowork.Protectionmode,RAMbyMCU,oscillatorisfrozen,alltheworktostopuntilthene*tinterruptionorhardwarereset.〔2〕ThesensorDS18B20Inthetraditionalanalogsignaldistancetemperaturemeasuringsystem,needgoodsolveleaderrorpensation,multi-pointmeasurementerrorandamplifyingcircuitswitchingtechnologiessuchaszerodrifterrorproblem,canachievehighmeasuringaccuracy.Anothergeneralmonitoringsiteoftheelectromagneticenvironmentisverybad,allkindsofjammingsignalisstronger,thesimulatedtemperaturesignalinterferenceandvulnerabletoproducemeasurementerrorandmeasuringprecision[5].Therefore,intemperaturemeasuringsystem,thestronganti-jammingcapabilityofthenewdigitaltemperaturesensoristhemosteffectivetosolvetheseproblems,paredwithothertemperaturesensorDSl820hasthefollowingfeatures:(1)theuniquesinglelineinterfaceway.DSl820inconnectionwiththemicroprocessoronlyneedoneinterfacetoimplementlineDSl820microprocessorsandtwo-waymunication.(2)morefunctionsimplifiesdistributedtemperaturedetectionapplication.(3)DSl820inusewithoutanyperipheraldevices.(4)power,voltagerangedataavailablefrom3.0Vto5.5V.(5)canmeasuretemperaturerangefrom-55degreesc++to125,incrementalvalue0.5°c,Fahrenheittemperaturerangefrom-67to+257,incrementalvalue0.9.(6)supportmulti-pointnetworkfunction.MultipleDS1820canpickonthesamebusand,moretemperaturemeasurement.(7)9temperatureresolution.Measuringresultsinnineserialtransmissionwaythedigitalquantity.(8)usercansettemperaturealarmthreshold.(9)havesupertemperaturesearchfunction.①.DSl8B20principleofworkTheinternalstructureofDS18B20DSl8B20temperaturemeasurementprinciplediagramshowninfigure3.2.Lowtemperaturecoefficientgraphoscillationfrequencyvibrationproducttemperatureisusedtoproducewithfi*edfrequency,pulsesignaltocounterl.Hightemperaturecoefficientcrystalstemperature-dependentitsoscillationfrequencychangesignificantly.Thesignalgeneratedasthecounter2inputpulses.Counter1,2andtemperatureregistersarecounterin-55degreespresetcorrespondingabasevalue.Counterltolowtemperaturecoefficientofthepulsesignalgeneratedcrystals,whenthecounterforsubtractioncountingthepresetvaluereducedto1,whenthetemperaturecounterOvaluewilladdl,counterthepresetvaluewillbelmanagain,tocounterthelstartlowtemperaturecoefficientofcrystaloscillatorpulsesignal,socyclecountuntilthecounter2,stopcountingtoOaccumulativetemperature,temperatureoftheregisterfortheregisterismeasuredvalues.Figure3.2accumulativeusedfortheslopepensationandfi*edtemperaturemeasurement,theoutputoftheprocessofnonlinearcorrectionislessthanthepresetvaluecounterl.②.AT89S52interfacemodeandDS18B20ChipDS18B20andtheconnectionhastwokinds:namelyparasiticpowerande*ternalpowersupplymode.Parasiticpowerway:intheparasiticpowersupplymode,thesignalfromthesinglechipDS18B20inlinedrawingenergyduringthehighlevelintheDQenergystoredintheinternalcapacitance,lowlevelinsignalintheenergyconsumedduringthecapacitanceonworkinguntilhigh-levelingagaintoparasiticpower(battery).Parasiticpowermodehasthreeadvantages:1)distancemeasuringtemperature,withoutthelocalpowersupply.2)noconventionalpowerintheconditionreadstheROM.3)circuit,withonlyonemoreconciserootI/Orealizetemperaturemeasurement.WanttomakeprecisetemperatureconversionchipDS18B20,I/Olinemustensurethatthetemperatureconversionperiod,duetoprovideenoughenergyconversionintemperatureduringeachDS18B20,whenthecurrent1mAtoworkafewtemperaturesensorinthesameroothangingontheI/Omulti-pointtemperaturemeasurement,onlyby4.7Kandresistancewillnotbeabletoprovideenoughenergy,whichcannotbeswitchovertemperatureorerrors.Thee*ternalpowersourcesupplyway:inthee*ternalpowersupplymodes,DS18B20workpowerbyVDDpin,I/Oaccesslinedoesnotneedstrongpullup,thereisnoshortageofelectricitypower,canensureaccuracyandconversioninthebustheorycanbearticulatedmultiplesensorDS18B20,multipointtemperaturemeasuringsystem.ThissystemUSESthee*ternalpowersource.ConnectionmethodisonefootgroundingandDS18B202feet(DQ)andAT89S52footanI/Oport,3feetlineup+5V.A89S52intheI/Oportand+5Vconnectionbetweena4.7Kpull-upresistors,toensurethenormaloperationofthedatacollection.Ifyouwanttotestsystem,posedmulti-pointtemperatureinthesamerootchipI/Oportinthesameline,andthemethodofconnectingtheparallelmorepiecesofDS18B20chip.〔3〕LCD1602LCD1602LCDmodulecanandmonolithicintegratedcircuitAT89S52directlyinterface.〔4〕BuzzerdrivercircuitDuetotheworkingcurrentbuzzerisparedmonlybig,soI/Omicrocontrollerisnotdirectlydrivenbyamplifyingcircuit,soitisgenerallyusedtodrive,toenlargecurrenttransistor.Whenthetemperatureisbelowsi*degreesCelsius,alarm.〔5〕FancircuitWhenthetemperatureishigherthan80°c,startfancircuit.Becausethejobisgreat,sousecurrentamplifiercircuittodrive,toenlargecurrenttransistor.Whenthetemperatureisabove80°c,giveamand,P2.6single-chipmicrocontrollerfootoutputlevel,triodeconduction,fans,electriccircuit,whichbegantoturnitdown.4、ThedesignofthesoftwaresystemThissystemUSESAT89S52devicesasthecore,withDSl8B20afterthecollecteddata,andthetemperatureinsidethedatastorageAT89S52deposit,LCDdisplay,andparedwiththepriorvalue,andthentheoutputsignalbyMCUco
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 系統(tǒng)架構(gòu)師職業(yè)能力的構(gòu)建考題試題及答案
- 行為醫(yī)學(xué)第三試題及答案
- 衛(wèi)生管理證書考試動態(tài)了解試題及答案
- 網(wǎng)絡(luò)規(guī)劃設(shè)計師考試中的基礎(chǔ)知識講解試題及答案
- 系統(tǒng)架構(gòu)設(shè)計師考試背景中的知識更新機制與現(xiàn)實應(yīng)用考察試題及答案
- 激光工程師證書考試的復(fù)習(xí)策略試題及答案
- 系統(tǒng)架構(gòu)設(shè)計師的持續(xù)學(xué)習(xí)與考試適應(yīng)性試題及答案
- 藥劑考試學(xué)生成果轉(zhuǎn)化試題及答案
- 藥物質(zhì)量標(biāo)準與控制考題試題及答案
- 系統(tǒng)架構(gòu)設(shè)計師考試各模塊重點解析試題及答案
- 第十五講新時代與中華民族共同體建設(shè)2012- -中華民族共同體概論專家大講堂課件
- 2025年中國鐵路蘭州局集團招聘筆試參考題庫含答案解析
- 2024年4月自考06088管理思想史試題
- MSOP(測量標(biāo)準作業(yè)規(guī)范)測量SOP
- 聚苯胺的結(jié)構(gòu)和形貌表征分析結(jié)果
- 初中花城版八年級下冊音樂4.狂歡之歌(15張)ppt課件
- 常用標(biāo)準波導(dǎo)和法蘭尺寸
- 改良ADA法脫硫原理
- (最新)四星級酒店標(biāo)準
- 管道完整性管理實施方案(共26頁)
- 原長沙鉻鹽廠鉻污染場地土壤修復(fù)-技術(shù)方案
評論
0/150
提交評論