【正文】
單片機(jī)原理及應(yīng)用課程設(shè)計(jì) 1 信息工程學(xué)院 《單片機(jī)原理與外圍電路》課程論文 題目: 基于單片機(jī)的數(shù)字溫度計(jì)設(shè)計(jì) 姓名: 金鑫 學(xué)號(hào): 50112113 班級(jí): 計(jì)算機(jī) 153 單片機(jī)原理及應(yīng)用課程設(shè)計(jì) 2 摘要: 隨著時(shí)代的進(jìn)步和發(fā)展,單片機(jī)技術(shù)已經(jīng)普及到我們生活、工作、科研、各個(gè)領(lǐng)域,已經(jīng)成為一種比較成熟的技術(shù) , 本 文主要介紹了一個(gè)基于 89S51 單片機(jī)的測(cè)溫系統(tǒng),詳細(xì)描述了利用數(shù)字溫度傳感器 DS18B20 開發(fā)測(cè)溫系統(tǒng)的過(guò)程,重點(diǎn)對(duì)傳感器在單片機(jī)下的硬件連接,軟件編程以及各模塊系統(tǒng)流程進(jìn)行了詳盡分析,對(duì)各部分的電路也一一進(jìn)行了介紹 ,該系統(tǒng)可以方便的實(shí)現(xiàn)實(shí)現(xiàn)溫度采集和顯示,并可根據(jù)需要任意設(shè)定上下限報(bào)警溫度,它使用起來(lái)相當(dāng)方便,具有精度高、量程寬、靈敏度高、體積小、功耗低等優(yōu)點(diǎn),適合于我們?nèi)粘I詈凸ぁ⑥r(nóng)業(yè)生產(chǎn)中的溫度測(cè)量,也可以當(dāng)作溫度處理模塊嵌入其它系統(tǒng)中,作為其他主系統(tǒng)的輔助擴(kuò)展。 DS18B20 與AT89C51 結(jié)合實(shí)現(xiàn)最簡(jiǎn)溫度檢測(cè)系統(tǒng),該系統(tǒng)結(jié)構(gòu)簡(jiǎn)單,抗干擾能力強(qiáng),適合于惡劣環(huán)境下進(jìn)行現(xiàn)場(chǎng)溫度測(cè)量, 有廣泛的應(yīng)用前景。 關(guān)鍵詞: 單片機(jī);溫度檢測(cè); AT89S51; DS18B20; ABSTRACT: Along with the progress and development of the ages, single slice the machine technique has already make widely available the life is to us,work,research,each realm, have already bee the technique of a kind of parison maturity. This paper mainly describes a temperature measurement system based on 89S51 singlechip, detailedly describing the development process use digital temperature sensor, the paper introduces the hardware connectivity and software programming of the DS18B20 based on the singlechip, and give the software flow chart of each module,as well as introduced each circuit of the can easily to collect and display the temperature, it can also arbitrary set alarm temperature according to the actual need, It is used convenience, it has high precision,wide range ,high sensitivity, small size,and low power dissipation, The device is especially applied to measure temperature in people39。s daily lives , industrial and agricultural production,and also easily as a temperature processing module embed in the other system, turn into as a plementary expansion. Key word : Singlechip temperature measurement。AT89S51。 DS18B20 單片機(jī)原理及應(yīng)用課程設(shè)計(jì) 3 目錄 1 緒論 ...................................................................................................................................... 4 設(shè)計(jì)背景 .................................................................................................................... 4 國(guó)內(nèi)外現(xiàn)狀 ................................................................................................................. 4 課題的設(shè)計(jì)目的 ......................................................................................................... 5 課題的主要工作 ........................................................................................................... 5 2 系統(tǒng)方案設(shè)計(jì) ........................................................................................................................ 6 方案選擇 ................................................................................................................... 6 系統(tǒng)的總 體設(shè)計(jì)方案 .................................................................................................. 6 3 硬件設(shè)計(jì) ............................................................................................................................... 8 STC89C52RC 芯片功能簡(jiǎn)介 .......................................................................................... 8 STC89C52RC 芯片簡(jiǎn)介 ...................................................................................... 8 引腳功能 ......................................................................................................... 8 DS18B20 芯片簡(jiǎn)介 .....................................................................................................12 芯片簡(jiǎn)介 ........................................................................................................12 DS18B20 的外形和內(nèi)部結(jié)構(gòu) .............................................................................13 DS18B20 的工作時(shí)序 .......................................................................................15 DS18B20 與單片機(jī)的典型接口設(shè)計(jì) ..................................................................17 DS18B20 的各個(gè) ROM 命令 ................................................................................17 MAX232 簡(jiǎn)介 ..............................................................................................................19 RS232 接口簡(jiǎn)介 .........................................................................................................20 RS232 接口的電平轉(zhuǎn)換 ....................................................................................21 RS232 總線接口標(biāo)準(zhǔn) .....................................................................................21 系統(tǒng)總體電路圖 .........................................................................................................23 4 系統(tǒng)軟件設(shè)計(jì) ......................................................................................................................23 各模塊的程序設(shè)計(jì) ....................................................................................................23 主程序流程圖 ..................................................................................................23 讀出溫度子程序 .............................................................................................25 溫度轉(zhuǎn)換命令子程序 ......................................................................................25 計(jì)算溫度子程序 .............................................................................................26 顯示數(shù)據(jù)刷新子程序 ......................................................................................27 報(bào)警子程序 ....................................................................................................27 按鍵掃描處理子程序 ......................................................................................28 Protues 仿真 ............................................................................................................28 5 結(jié)論 .....................................................................................................................................30 參考文獻(xiàn) ........................................................................................