版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
.z基于單片機的多功能溫度檢測系統(tǒng)的設計引言
隨著社會的開展和技術的進步,人們越來越注重溫度檢測與顯示的重要性。溫度檢測與狀態(tài)顯示技術與設備已經普遍應用于各行各業(yè),市場上的產品層出不窮。溫度檢測及顯示也逐漸采用自動化控制技術來實現監(jiān)控。本課題就是一個溫度檢測及狀態(tài)顯示的監(jiān)控系統(tǒng)。二、系統(tǒng)方案
本系統(tǒng)采用AT89S52作為該系統(tǒng)的單片機。系統(tǒng)整體硬件電路包括,電源電路,傳感器電路,溫度顯示電路,上下限報警電路等如圖1所示。圖中報警電路可以在被測溫度不在上下限*圍內時,發(fā)出報警鳴叫聲音。溫度控制的根本原理為:當DSl8B20采集到溫度信號后,將溫度信號送至AT89S52中處理,同時將溫度送到LCD液晶屏顯示,單片機根據初始化設置的溫度上下限進展判斷處理,即如果溫度大于所設的最高溫度就啟動風扇降溫;如果溫度小于所設定的最低溫度就啟動報警裝置。溫度控制器的原理圖二三、系統(tǒng)硬件設計1.單片機AT89S52的介紹
AT89S52是一種低功耗、高性能CMOS8位微控制器,具有8K可編Flash存儲器。使用Atmel公司高密度非易失性存儲器技術制造,與工業(yè)80C51產品指令和引腳完全兼容。片上Flash允許程序存儲器在系統(tǒng)編程,亦適于常規(guī)編程器。在單芯片上,擁有靈巧的8位CPU和在系統(tǒng)可編程Flash,使AT89S52為眾多嵌入式控制應用系統(tǒng)提供高靈活、超有效的解決方案[5]。AT89S52具有以下標準功能:8k字節(jié)Flash,256字節(jié)RAM,32位I/O口線,看門狗定時器,2個數據指針,三個16位定時器/計數器,一個6向量2級中斷構造,全雙工串行口,片內晶振及時鐘電路。另外,AT89S52可降至0Hz靜態(tài)邏輯操作,支持2種軟件可選擇節(jié)電模式??臻e模式下,CPU停頓工作,允許RAM、定時器/計數器、串口、中斷繼續(xù)工作。掉電保護方式下,RAM內容被保存,振蕩器被凍結,單片機一切工作停頓,直到下一個中斷或硬件復位為止。
2.DS18B20傳感器的介紹
在傳統(tǒng)的模擬信號遠距離溫度測量系統(tǒng)中,需要很好的解決引線誤差補償問題、多點測量切換誤差問題和放大電路零點漂移誤差問題等技術問題,才能夠到達較高的測量精度。另外一般監(jiān)控現場的電磁環(huán)境都非常惡劣,各種干擾信號較強,模擬溫度信號容易受到干擾而產生測量誤差,影響測量精度[5]。因此,在溫度測量系統(tǒng)中,采用抗干擾能力強的新型數字溫度傳感器是解決這些問題的最有效方案,與其它溫度傳感器相比DSl820具有以下特點:
(1)獨特的單線接口方式。DSl820在與微處理器連接時僅需要一條接口線即可實現微處理器與DSl820的雙向通訊。(2)多點功能簡化了分布式溫度檢測的應用。(3)DSl820在使用中無需任何外圍元件。(4)可用數據線供電,電壓*圍從3.0V到5.5V。(5)可測量的溫度*圍從-55℃到+125℃,增量值0.5℃;華氏溫度*圍從-67到+257,增量值0.9。(6)支持多點組網功能。多個DS1820可以并接在同一條總線上,實現多點測溫。(7)9位的溫度分辨率。測量結果以9位數字量方式串行傳送。(8)用戶可設定溫度報警門限值。(9)有超溫度搜尋功能。
〔1〕DSl8B20的工作原理
DS18B20的內部構造DSl8B20的測溫原理框圖如圖3.2所示。圖中低溫度系數品振的振蕩頻率受溫度影響很小,用于產生同定頻率的脈沖信號送給計數器l。高溫度系數晶振隨溫度變化其振蕩頻率明顯改變。所產生的信號作為計數器2的脈沖輸入。計數器1、計數器2和溫度存放器被預置在-55℃所對應的一個基數值。計數器l對低溫度系數晶振產生的脈沖信號進展減法計數,當計數器1的預置值減到O時,溫度計數器的值將加l,計數器l的預置值將被重新裝人,計數器l重新開場對低溫度系數晶振產生的脈沖信號進展計數,如此循環(huán)直到計數器2計數到O時,停頓溫度存放器的累加,此時溫度存放器中的數值即為所測溫度。圖3.2中的斜率累加器用于補償和修正測溫過程中的非線性,其輸出小于修正計數器l的預置值。
〔2〕DS18B20與AT89S52的接口方式
DS18B20與單片機的連接方式有兩種:即寄生電源方式和外部電源方式。
寄生電源方式:在寄生電源供電方式下,DS18B20從單線信號線上汲取能量:在信號線DQ處于高電平期間把能量儲存在內部電容里,在信號線處于低電平期間消耗電容上的電能工作,直到高電平到來再給寄生電源〔電容〕充電。寄生電源方式有三個好處:1〕進展遠距離測溫時,無需本地電源。2〕可以在沒有常規(guī)電源的條件下讀取ROM。3〕電路更加簡潔,僅用一根I/O口實現測溫。要想使DS18B20進展準確的溫度轉換,I/O線必須保證在溫度轉換期間提供足夠的能量,由于每個DS18B20在溫度轉換期間工作電流到達1mA,當幾個溫度傳感器掛在同一根I/O線上進展多點測溫時,只靠4.7K上拉電阻就無法提供足夠的能量,會造成無法轉換溫度或溫度誤差極大。
外部電源供電方式:在外部電源供電方式下,DS18B20工作電源由VDD引腳接入,此時I/O線不需要強上拉,不存在電源電流缺乏的問題,可以保證轉換精度,同時在總線上理論可以掛接任意多個DS18B20傳感器,組成多點測溫系統(tǒng)。
本系統(tǒng)采用外部電源方式。連接方法即DS18B20的1腳接地,2腳(DQ引腳)與AT89S52的一根I/O口線相連,3腳接+5V。在A89S52的I/O口線與+5V之間連接一4.7K的上拉電阻,以保證數據采集的正常進展。假設要組成多點溫度檢測系統(tǒng),可在單片機的同一根I/O口線上,以一樣的連接方法并聯多片DS18B20芯片。
3、LCD1602液晶屏
1602液晶顯示模塊可以和單片機AT89S52直接接口。4、蜂鳴器驅動電路
由于蜂鳴器的工作電流一般比較大,以致于單片機的I/O口是無法直接驅動的,所以要利用放大電路來驅動,一般使用三極管來放大電流就可以了。當所測的溫度低于6攝氏度時,報警。
5、風扇電路
當所測的溫度高于80攝氏度時,啟動風扇電路。因為工作電流比較大,所以用放大電路來驅動,即用三極管來放大電流就可以了。當溫度高于80℃時,給單片機一個命令,單片機P2.6引腳輸出高電平,三極管導通,風扇電路接通,電風扇開場轉動,從而起到降溫作用。
四、系統(tǒng)的軟件設計
本系統(tǒng)采用AT89S52作為核心處理器件,把經過DSl8B20現場實時采集到的溫度數據,存入AT89S52的內部數據存儲器,送液晶顯示,并與預先設定值進展比較,然后由單片機輸出信號去控制風扇電路和報警電路。多功能溫度檢測顯示系統(tǒng)軟件主要包括:函數聲明、延遲時間函數、DS18B20初始化函數、讀出DS18B20當前的溫度、溫度數據轉化成液晶字符顯示等程序。五、小結
隨著工業(yè)的不斷開展,對溫度測量的要求來越高,而且測量*圍也越來越廣,因此對溫度檢測技術的要求也越來越高。
本文介紹了以DSl8B20新型數字溫度傳感器、AT89S52單片機、LCD1602液晶顯示模塊為主體構建的溫度檢測顯示系統(tǒng)。說明了系統(tǒng)硬件電路、系統(tǒng)主程序與各模塊子程序的設計。本系統(tǒng)采用的是DALLAS公司推出的數字式溫度傳感器DS18B20,無需外加A/D即可輸出數字量,把溫度信號直接轉換成串行數字信號供微機處理。因此。該系統(tǒng)具有硬件電路構造簡單、轉換精度高、顯示結果清晰穩(wěn)定、本錢低等顯著優(yōu)點。在諸如糧庫測溫、智能建筑、中央空調等多種需要溫度檢測的場合具有較好的應用前景。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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 完整版拆除工程施工方案
- DB6103T 41-2025玉米-小麥輪作機械化生產技術規(guī)范
- DB3715T 76-2025地理標志產品 冠縣鴨梨
- 個人小額借款合同模板全集
- 萬科地產租賃合同范本
- 2025年大型機械租賃服務合同
- 二手房買賣標準合同樣本
- 京東店鋪租賃合同模板
- 臨時借調合同模板(企業(yè)與員工)
- 個人汽車抵押合作合同書
- 施工現場人力資源施工機具材料設備等管理計劃
- 第八章《運動和力》達標測試卷(含答案)2024-2025學年度人教版物理八年級下冊
- 民辦幼兒園務工作計劃
- 2025年華僑港澳臺生聯招考試高考地理試卷試題(含答案詳解)
- 2025年市場拓展工作計劃
- 中國革命戰(zhàn)爭的戰(zhàn)略問題(全文)
- 《數學歸納法在中學解題中的應用研究》9000字(論文)
- 《大學英語四級詞匯大全》
- 第六章-1八綱辨證
- 《中國古典建筑》課件
- 2021年酒店餐飲傳菜員崗位職責與獎罰制度
評論
0/150
提交評論