【正文】
時代的進步和發(fā)展,單片機技術(shù)已經(jīng)普及到我們生活,工作,科研,各個領(lǐng)域,已經(jīng)成為一種比較成熟的技術(shù)。硬件電路主要包括主控制器,測溫電路和顯示電路等,主控制器采用單 片機STC89C52,溫度傳感器采用美國 DALLAS 半導體公司生產(chǎn)的 DS18B20,顯示電路采用 4 位共 陰 極 LED 數(shù)碼管以動態(tài)掃描法直讀顯示。 關(guān)鍵詞: 單片 機, 數(shù)字控制, DS18B20, STC89C52, 數(shù)字溫度計 Abstract With the progress and development, singlechip technology has spread to our lives, work, research in various fields has bee a relatively mature technology. The paper introduced one kind of new digital thermometer that take the MicroController Unit as the primary control ponent and take DS18B20 as the temperature sensor, the thermometer are multipurpose thermometer, you can set upper and lower temperature alarm, when the temperature range is not set, it could be reported . The system mainly included the design of the hardware electric circuit and the design of the system program . The hardware electric circuit mainly included the master controller, the temperature measured electric circuit and the display circuit and so on, the master controller used MicroController Unit STC89C52, the temperature sensor used DS18B20 which the American DALLAS semiconductor pany produces, the display circuit used 4 altogether mon Cathode LED numerical tube by the dynamic scanning method straight to read the demonstration. The system program mainly included the master routine, the readout temperature subroutine, the temperature transformation order subroutine, the calculated temperature subroutine,demonstrated the data renovates subroutine, alarm temperature setting subroutine and so on. Because used the advanced version intelligence temperature sensor DS18B20 as the examine part, pared with the traditional thermometer, this digital thermometer reduced the exterior hardware electric circuit, has characteristic that the low cost and was easy to use. The DS18B20 thermometer also may used to the high temperature warning, the longdistance range multi spots temperature measured aspect and so on temperature control carries on the application development, has the very good prospects for development. Key words: MicroController Unit, Digital control, DS18B20, STC89C52, Digital Thermometer 目 錄 1 緒論 ...................................................................................................................................... 1 軟件編程 Keil51 的簡介 ......................................................................................... 2 硬件電路設(shè)計 Proteus 的簡介 ................................................................................ 2 設(shè)計中用到的所有電子器件 .................................................................................. 2 2 總體設(shè)計方案 ...................................................................................................................... 3 設(shè)計 要求 .................................................................................................................. 3 數(shù)字溫度計設(shè)計方案論證 ...................................................................................... 3 總體設(shè)計框圖 .......................................................................................................... 5 3 系統(tǒng)硬件電路組成及工作原理 .......................................................................................... 6 DS18B20 溫度傳感器與單片機的接口電路 ......................................................... 6 DS18B20 的使用方法 ........................................................................................... 11 STC89 系列高性能單片機 .................................................................................... 12 7 段 LED 數(shù)碼管電路及原理 ............................................................................... 14 溫度報警電路 ........................................................................................................ 15 系統(tǒng)整體硬件電路 ................................................................................................ 16 4 系統(tǒng)軟件程序設(shè)計 ............................................................................................................ 18 主程序 .................................................................................................................... 18 讀取溫度子程序 .................................................................................................... 19 溫度轉(zhuǎn)換命令子程序 ............................................................................................ 20 計算溫度子程序 .................................................................................................... 21 顯示數(shù)據(jù)刷新子程序 ............................................................................................ 22 溫度報警子程序 .................................................................................................... 23 5 系統(tǒng)總體調(diào)試 .................................................................................................................... 24 硬件調(diào)試 ................................................................................................................ 24 排除邏輯故障 ................................................................................................ 24 排除元器件失效 ............................................................................................ 24 排除電源故障 ................................................................................................ 24 軟件調(diào)試 ................................................................................................................ 25 6 設(shè)計總結(jié)與體會 ................................................................................................................ 27 設(shè)計總結(jié) ................................................................................................................ 27 畢業(yè)設(shè)計心得體會 ................................................................................................ 28 參 考 文 獻 ...................................................................................................................... 29 致 謝 .................