【正文】
提供全套畢業(yè)論文圖紙,歡迎咨詢 摘要 隨著中國社會經(jīng)濟(jì)的發(fā)展,人們生活水平的提高,人們對生活環(huán)境的舒適度也越來越重視,比如室內(nèi)的溫度情況。所以基于以單片機(jī)為核心的溫度采集和控制的系統(tǒng)出現(xiàn)滿足了人們的這一要求,本論文以 STC89C52RC 單片機(jī)為主控器件,以數(shù)字溫度傳感器 DS18B20 進(jìn)行當(dāng)前溫度值的采集,并將當(dāng)前溫度值通過LCD12864 來顯示出來;當(dāng)溫度高于或低于期望值時(shí),通過 L298N 來控制電機(jī)對溫度進(jìn)行實(shí)時(shí)調(diào)控,使溫度達(dá)到期望值。本系統(tǒng)的硬件設(shè)計(jì)包括單片機(jī)最小系統(tǒng),溫度檢測電路, LCD 顯示電路,按鍵控 制電路和電機(jī)控制電路。軟件設(shè)計(jì)包括主程序,溫度檢測子程序,按鍵檢測子程序, LCD 液晶顯示子程序,電機(jī)控制子程序等。 關(guān)鍵詞:單片機(jī); DS18B20; LCD 液晶顯示;電機(jī)控制 II The Design of Control System Base on Microcontroller at Room Temperature Abstract With the development of China39。s social economy, people living standard rise, people also pay more and more attention to the living environment of the fort, such as indoor and outdoor temperature conditions. So based on single chip microputer as the core temperature gathering and control system to meet the people of the requirements, this thesis with STC89C52RC MCU as the master device, with digital temperature sensor DS18B20 the temperature value of the collection, and the current temperature value displayed by LCD12864。 When the temperature higher or lower than expected, to control the motor by L298N to realtime control of temperature, the temperature reached expectations. The hardware design of this system include the single chip microputer minimum system, temperature detection circuit, LCD display circuit, key control circuit and the motor control circuit. Software design includes the main program, temperature detection subroutine, button detection subroutine, LCD liquid crystal display subroutine, motor control subroutine. Key Words: microcontroller; DS18B20; LCD liquid crystal display; motor control III 目錄 摘要 ................................................................ I Abstract........................................................... II 引言 ................................................................ 1 1 概述 ............................................................ 2 設(shè)計(jì)背景和意義 ............................................. 2 設(shè)計(jì)思想 ................................................... 2 系統(tǒng)的總體設(shè)計(jì) ............................................. 2 方案比較 .............................................. 2 系統(tǒng)框圖 .............................................. 3 設(shè)計(jì)重點(diǎn)與難點(diǎn) ............................................. 3 2 硬件電路設(shè)計(jì) .................................................... 4 STC89C52RC 單片機(jī)簡介 ...................................... 4 STC89C52RC 單片機(jī)管腳圖 .................................... 4 單片機(jī)最小系統(tǒng)電路圖 ....................................... 5 LCD12864 液晶簡介 .......................................... 5 LCD12864 的接口原理圖 ................................. 6 按鍵工作原理 ............................................... 6 按鍵原理圖 ............................................ 6 L298N 簡介 ................................................. 7 L298N 原理圖 .......................................... 7 DS18B20 溫度傳感器簡介 ..................................... 8 DS18B20 原理圖 ........................................ 8 直流電機(jī)工作原理簡介 ....................................... 8 系統(tǒng)總電路原理圖 ........................................... 9 3 軟件設(shè)計(jì) ........................................................ 10 軟件整體設(shè)計(jì) .............................................. 10 主程序流程圖 .............................................. 10 溫度采集子程序 ............................................ 11 液晶顯示子程序 ............................................ 12 電機(jī)控制處理程序 .......................................... 13 按鍵處理程序 .............................................. 14 按鍵軟件消抖 ......................................... 14 按鍵檢測流程圖 ....................................... 15 4 系統(tǒng)調(diào)試 ....................................................... 16 硬件調(diào)試 .................................................. 16 編譯軟件 KIEL4 的使用 ...................................... 16 程序的燒錄 ................................................ 17 結(jié)論 ............................................................... 19 參考文獻(xiàn) ........................................................... 20 附錄 A 單片機(jī)程序 ................................................. 21 致謝 ............................................................... 31 1 引言 隨著科技的發(fā)展,單片機(jī)產(chǎn)品越來越廣泛地應(yīng)用于我們生活, 以單片機(jī)為核心的溫度采集與控制系統(tǒng)在很大程度上提高了生產(chǎn)生活中對溫度的控制水平。 傳統(tǒng)的溫度檢測以熱敏電阻為 主, 熱敏電阻的成本低, 所產(chǎn)生的信號 為模擬信號 , 需要通過 A/D 轉(zhuǎn)換后才能被單片機(jī)所識別, 而且 接線方式對其信號影響較大,所以 可靠性相對較差。與傳統(tǒng)的 熱敏電阻測溫 相比, DS18B20 是數(shù)字溫度傳感器,具 有讀數(shù)方便,測 量 范圍廣,測 量精確 高,電路設(shè)計(jì)簡單 等 優(yōu) 點(diǎn)。 本設(shè)計(jì)的采用 STC89C52RC 單片機(jī)對溫度傳感器 DS18B20 的溫度進(jìn)行實(shí)時(shí)采集和控制,將采集的溫度用 LCD 液晶顯示出來,通過按鍵設(shè)定溫度控制的范圍,并利用電機(jī)的正反轉(zhuǎn)進(jìn)行溫度調(diào)節(jié),以達(dá)到恒溫的效果。 2 1 概述 設(shè)計(jì)背景和意義 隨著時(shí)代的進(jìn)步和 發(fā)展,人們的生活水平的提高,人們對生活的舒適度要求也越來越高,尤其是溫度。經(jīng)科學(xué)研究發(fā)現(xiàn), 25℃的環(huán)境最適宜人類生活。在這個(gè)溫度下,人體沒有冷熱感,身體內(nèi)的毛細(xì)血管舒張平衡,感覺非常舒適。伴隨著各種新的技術(shù)不斷應(yīng)用于人們生活,單片機(jī)產(chǎn)品更是得到了飛速發(fā)展, 在各種微機(jī)測量和控制技術(shù)里得到了廣泛的應(yīng)用, 所以基于以單片機(jī)為核心的溫度采集和控制的系統(tǒng)出現(xiàn)滿足了人們的這一要求, 數(shù)字溫度控制系統(tǒng)便是其中之一。由于 傳統(tǒng)的 熱敏電阻 溫度采集方法不僅費(fèi)時(shí)費(fèi)力,而且精度差, 受環(huán)境影響大,易出現(xiàn)不穩(wěn)定因數(shù),可靠性較差, 測溫準(zhǔn)確度低 ,誤差 較大。而 使用單片機(jī)作為核心 的數(shù)字溫度控制系統(tǒng),該系統(tǒng) 使得溫度的采集和數(shù)據(jù)處理問題能夠得到很好的解決 , 簡化數(shù)據(jù)傳輸與處理過程 , 具有集成度高,通用性好,