【正文】
量多,居各種傳感器之首。傳統(tǒng)的分立式溫度傳感器如熱電偶傳感器。 溫度傳感器按傳感器與被測介質(zhì)的接觸方式可分為兩大類:一類是接觸式溫度傳感器,一類是非接觸式溫度傳感器。這種測溫方法精度比較高,并可測量物體內(nèi)部的溫度分布。 非接觸測溫的測溫元件與被測對象互不接觸。此種測穩(wěn)方法的主要特點(diǎn)是可測量運(yùn)動狀態(tài)的小目標(biāo)及熱容量小或變化迅速的對象,也可測量溫度場的溫度分布,但受環(huán)境的影響比較大。該產(chǎn)品采用美國DALLAS公司生產(chǎn)的 DS18B20可組網(wǎng)數(shù)字溫度傳感器芯片封裝而成,具有耐磨耐碰,體積小,使用方便,封裝形式多樣,適用于各種狹小空間設(shè)備數(shù)字測溫和控制領(lǐng)域?,F(xiàn)場溫度直接以“一線總線”的數(shù)字方式傳輸,大大提高了系統(tǒng)的抗干擾性。而且新一代產(chǎn)品更便宜,體積更小。在上一章中已經(jīng)將整個(gè)系統(tǒng)的硬件部分作了介紹,在這一章中將就系統(tǒng)的軟件部分加以分析說明。 系統(tǒng)軟件流程圖開始系統(tǒng)初始化采集溫度和煙霧信號聲光報(bào)警溫度煙霧是否超過設(shè)定上限YN結(jié)束 ADC0809流程圖開始模擬量輸入初始化啟動A/D正在轉(zhuǎn)化結(jié)束轉(zhuǎn)化數(shù)字量輸出結(jié)束includesbit OE=P3^2。sbit ST=P3^0。sbit light=P1^1。void DelayMS(unsigned int ms) { unsigned int i,j。ims。j1141。}void Delayus(unsigned int us){unsigned int i。ius。}void main(){ unsigned char temp。 TL0=0x00。 TR0=1。 OE=1。 while(1) { DelayMS(10)。 ST=1。 ST=0。 temp=P2。 } else { light=1。} DS18B20流程圖開始初始化啟動溫度轉(zhuǎn)換初始化讀取溫度寄存器讀取高低位溫度結(jié)束轉(zhuǎn)換includedefine uchar unsigned char define uint unsigned int sbit DQ = P1^7。void delay(uchar z){ uchar x,y。x1。y1。}void tmpDelay(uint num)//延時(shí)函數(shù){ while(num)。 DQ = 1。 //稍做延時(shí) DQ = 0。 //精確延時(shí) 大于 480us DQ = 1。 x=DQ。}unsigned char ReadOneChar()//讀一個(gè)字節(jié){ unsigned char i=0。 for (i=8。i) { DQ = 0。 DQ = 1。 tmpDelay(4)。}void WriteOneChar(unsigned char dat)//寫一個(gè)字節(jié){ unsigned char i=0。 i0。 DQ = datamp。 tmpDelay(4)。 dat=1。}unsigned int Readtemp()//讀取溫度{ unsigned char a=0。 uchar t=0。 WriteOneChar(0xCC)。 // 啟動溫度轉(zhuǎn)換 Init_DS18B20()。 //跳過讀序號列號的操作 WriteOneChar(0xBE)。 //連續(xù)讀兩個(gè)字節(jié)數(shù)據(jù) //讀低8位 b=ReadOneChar()。0x0f)。0xf0)。 return(t)。 while(1) { t=Readtemp()。 delay(100)。 delay(100)。51的編程語言常用的有二種:一種是匯編語言,一種是C語言。對于開發(fā)周期來說,中大型的軟件編寫用C語言的開發(fā)周期通常要小于匯編語言很多。使用C語言肯定要使用到C編譯器,以便把寫好的C程序編譯為機(jī)器碼,這樣單片機(jī)才能執(zhí)行編寫好的程序。因此,很多開發(fā)51應(yīng)用的工程師或普通的單片機(jī)愛好者,對它十分喜歡。安裝好后,建立第一個(gè)C項(xiàng)目。保存該文件,加上擴(kuò)展名(.asm或a51)。Project”菜單,出現(xiàn)以個(gè)對話框,要求給工程起一個(gè)名字,我們輸入examl1,不需要擴(kuò)展名,點(diǎn)擊保存按鈕,出現(xiàn)第二個(gè)對話框?;氐街鹘缑妫藭r(shí),在工程窗口的文件頁中,出現(xiàn)了“Target1”,前面有Group1”,這時(shí)的工程還是一個(gè)空工程,里面什么文件也沒有,需要手動把剛才編寫好的源程序加入,點(diǎn)擊“Source選中其中的“AddtoSourceSourcefileFile(*.C)”,這樣。Group雙擊文件名,即打開源程序。設(shè)置完成以后安確認(rèn)返回主界面,工程建立、設(shè)置完畢。選擇菜單ProjectBuild target,對當(dāng)前工程進(jìn)行連接,如果當(dāng)前文件已修改軟件會先對該文件進(jìn)行比阿尼,然后在連接以產(chǎn)生目標(biāo)代碼。(2)在進(jìn)入Keil的調(diào)試環(huán)境以后,發(fā)現(xiàn)程序有錯解決方法:將光標(biāo)定位于需要修改的程序上,用菜單,Debug》Inline Assambly…即可出現(xiàn)對話框,Enter New 后面的編輯框內(nèi)直接輸入需要修改的程序語句,輸入完之后鍵入回車將自動指向下一條語句,可以繼續(xù)修改,如果不在需要修改,可以點(diǎn)擊右上角的關(guān)閉按鈕關(guān)閉窗口。斷點(diǎn)設(shè)置的方法有多種,常用的是在某一程序行設(shè)置斷點(diǎn),設(shè)置好斷點(diǎn)后可以全速運(yùn)行程序,一旦執(zhí)行到該程序行即停止,可在此觀察有關(guān)變量值,以確定問題所在。這些功能也可以用工具條上的快捷鍵進(jìn)行設(shè)置。主要錯在這里。溫度80℃,煙霧50%,黃色、綠色、紅色燈同時(shí)亮并且喇叭發(fā)出報(bào)警聲??偨Y(jié)與展望本設(shè)計(jì)方案達(dá)到了任務(wù)書的要求,本課題研究和設(shè)計(jì)火災(zāi)報(bào)警器感煙控制系統(tǒng)。作為一個(gè)本科生的畢業(yè)設(shè)計(jì),由于經(jīng)驗(yàn)的匱乏,難免有的地方,如果沒有導(dǎo)師的督促指導(dǎo),以及一起工作的同學(xué)們的支持,既是一次機(jī)遇,又是一次挑戰(zhàn)。通過實(shí)際工程的設(shè)計(jì)也使我了解到書本知識和實(shí)際應(yīng)用的差別。通過這次畢業(yè)設(shè)計(jì),使我得到了一次用專業(yè)知識、專業(yè)技能分析和解決問題全面系統(tǒng)的鍛煉。在設(shè)計(jì)過程,經(jīng)常會遇到這樣的情況,就是心里想老著這樣的接法可以行得通,但實(shí)際接上電路,總是實(shí)現(xiàn)不了。不過說也奇怪,整天想著這些問題,腦子和身體卻一點(diǎn)都不會覺得累,或許是那種渴望得到知識的欲念把疲勞趕到九宵云外去了吧!我沉得做畢業(yè)設(shè)計(jì)同時(shí)也是對課本知識的鞏固和加強(qiáng),平時(shí)看課本時(shí),有時(shí)問題老是弄不懂,做完課程設(shè)計(jì),那些問題就迎刃而解了。比如一些芯片的功能,平時(shí)看課本,這次看了,下次就忘了,主要是因?yàn)闆]有動手實(shí)踐過吧!認(rèn)識來源于實(shí)踐,實(shí)踐是認(rèn)識的動力和最終目的,實(shí)踐是檢驗(yàn)真理的唯一標(biāo)準(zhǔn)?;馂?zāi)探測與控制系統(tǒng)在應(yīng)用中相當(dāng)?shù)钠毡椋谠O(shè)計(jì)中我們提出了將語音報(bào)警系統(tǒng)和自動噴水系統(tǒng)與火災(zāi)探測系統(tǒng)相結(jié)合的思路。此外,目前火災(zāi)探測已經(jīng)大量應(yīng)用于工廠、學(xué)校、住宅,而城市公交系統(tǒng)則相對應(yīng)用較少,我們希望能將火災(zāi)探測項(xiàng)目向城市公交系統(tǒng)推行。致 謝畢業(yè)設(shè)計(jì)能夠如期完成,我的指導(dǎo)老師汪方斌老師給了我極大的幫助與支持。在我遇到困難時(shí)能耐心解答直至我明白。讓我明白,沒有付出,就沒有回報(bào)的真諦。汪老師要指導(dǎo)很多同學(xué)的論文,加上本來就有教學(xué)任務(wù),工作量之大可想而知。在不斷的接觸中,汪老師的樸實(shí)無華,平易近人的性格對我影響頗深。除汪老師之外,還要感謝我的同學(xué)們。尤其在程序的編寫方面,給了我很大的幫助。最重要的是一個(gè)人如果無法獨(dú)立完成一件事情,那么,同學(xué)和朋友就是你的依靠。他們默默的為我們操勞、付出。再次感謝在設(shè)計(jì)中給我?guī)椭睦蠋熀屯瑢W(xué)、還有在背后默默支持我們的父母!參考文獻(xiàn)[1] 197。m, CG, Wallman, H, Friction measurement methods and the correlation between road friction and traffic safety, S. N. R. a. T. R. Institute, ed. (2001)。[5] W. M. Irvine, and J. B. Pollack, Infrared optical properties of water and ice spheres, Icarus 8 1968, 324360 (1968)。s accumulation device ACC, register B and procedure state register PSW, etc. Person who accumulate ACC count by 2 input ends entered of checking etc. temporarily as one operation often, e from person who store 1 operation is it is it make operation to go on to count temporarily , operation result and loopback ACC with another one. In addition, ACC is often regarded as the transfer station of data transmission on 8051 inside . The same as general microprocessor, it is the busiest register. Help remembering that agreeing with A expresses in the order. The controller includes the procedure counter , the order is depositted, the order decipher, the oscillator and timing circuit, etc. The procedure counter is made up of counter of 8 for two, amounts to 16. It is a byte address counter of the procedure in fact, the content is the next IA that will carried out in PC. The content which changes it can change the direction that the procedure carries out . Shake the circuit in 8051 onechip puters, only need outer quartz crystal and frequency to finely tune the electric capacity, its frequency range is its 12MHZ of . This pulse signal, as 8051 basic beats of working, namely the minimum unit of time. 8051 is the same as other puters, the work in harmony under the control of the basic beat, just like an orchestra according to the beat play that is manded. There are ROM (procedure memory , can only read ) and RAM in 8051 slices (data memory, can is it can write ) two to read, they have each independent memory address space, dispose way to be the same with general memory of puter. Procedure 8051 memory and 8751 slice procedure memory capacity 4KB, address begin from 0000H, used for preserving the procedure and form constant. Data 8051 8751 8031 of memory data memory 128B, address false 00FH, use for middle result to deposit operation, the data are stored temporarily and the data are buffered etc.. In RAM of this 128B, there is unit of 32 byteses that can be appointed as the job register, this and general microprocessor is different, 8051 slice RAM and job register rank one formation the same to arrange the location. It is not very the same that the memory of MCS51 series onechip puter and general puter disposes the way in addition. General puter for first address s