【正文】
一月十三 日 I 目 錄 第 1章 緒 論 ............................................................. 1 系統(tǒng)的概述 ......................................................... 1 系統(tǒng)的要求 .......................................................... 1 系 統(tǒng)的主要模塊 ...................................................... 1 本系統(tǒng)的主要組成部分 ......................................... 1 各部分的功能 ................................................. 2 工作原理 ...................................................... 2 第 2章 設(shè)計(jì)的理論基礎(chǔ) ...................................................... 3 AT89C52的工作原理 .................................................. 3 CPU的結(jié)構(gòu) .................................................... 3 CPU的結(jié)構(gòu) I/O口結(jié)構(gòu) .......................................... 3 程序存儲(chǔ)器 .................................................... 3 定時(shí)器 ....................................................... 4 中斷系統(tǒng) ...................................................... 4 單總線數(shù)字溫度傳感器 DS18B20檢測(cè)電路 ................................ 5 DS18B20簡(jiǎn)單介紹 .............................................. 5 DS18B20 的性能特點(diǎn) ............................................ 5 DS18B20的測(cè)溫原理 ............................................ 6 LCD1602液晶顯示器 .................................................. 6 LCD1602簡(jiǎn)介 .................................................. 6 1602LCD的指令說明及時(shí)序 ...................................... 7 直流馬達(dá) ............................................................ 8 馬達(dá)工作的原理 ................................................ 8 馬達(dá)的基本構(gòu)造 ................................................ 9 第 3章 系統(tǒng)的硬件組成電路設(shè)計(jì) .............................................. 10 II 系統(tǒng)總硬件設(shè)計(jì) ..................................................... 10 時(shí)鐘電路 ........................................................... 10 AT89C52的復(fù)位電路 ................................................. 11 單總線數(shù)字溫度傳感器 DS18B20檢測(cè)電路 ............................... 11 LCD1602顯示模塊 .................................................. 12 驅(qū)動(dòng)電路 ........................................................... 12 第 4章 系統(tǒng)軟件的設(shè)計(jì) ..................................................... 14 ......................................................... 14 溫度檢測(cè) ........................................................... 14 ................................................. 14 溫度數(shù)據(jù)處理設(shè)計(jì) ............................................ 16 液晶顯示器 LCM1602................................................. 17 LCM1602初始化 .............................................. 17 ......................................................... 21 第 5章 系統(tǒng)調(diào)試 ........................................................... 22 第 6章 總結(jié)與展望 ......................................................... 23 總結(jié) .............................................................. 23 展望 .............................................................. 23 參考文獻(xiàn) .................................................................. 24 致 謝 .................................................................... 25 附錄 A:程序 ............................................................... 26 附錄 B:元件清單 ........................................................... 42 附錄 C:實(shí)物照片 ........................................................... 42 III 基于單片機(jī) AT89C52 的大棚溫度控制系 統(tǒng) 摘 要 蔬菜的生長(zhǎng)與溫度息息 相關(guān),對(duì)于蔬菜大棚來說,最重要的一個(gè)管理因素是溫度控制。溫度不合適 , 蔬菜 則停止生長(zhǎng)或者生長(zhǎng)速度減慢, 從而造成不可估量的損失。如果僅靠人工控制既耗人力,又容易 造成誤差 。 單片機(jī)微型計(jì)算機(jī)是微型計(jì)算機(jī)的一個(gè)重要分支,也是頗具生命力的機(jī)種。 單片機(jī)具有體積小、集成度高、性能穩(wěn)定、控 制功能強(qiáng)、易擴(kuò)展、低功耗、價(jià)格便宜等特點(diǎn) , 所以單片機(jī)市場(chǎng)前景廣闊。 系統(tǒng)以 AT89C52單片機(jī)為基礎(chǔ) ,通過數(shù)字及模擬式對(duì)溫度進(jìn)行 采集并 檢測(cè),通過顯示屏顯示當(dāng)前溫度。 【關(guān)鍵詞】 大棚溫度控制系統(tǒng) AT89C52 DS18B20 LCD1602 直流 馬達(dá) IV The Greenhouse Temperature Control System Based on AT89C52 MCU Abstract The growth of vegetables and temperature are closely related, for vegetable shed, one of the most important management factor is the temperature control. Temperature not appropriate, then stop the vegetable growth or growth slowed, causing the immeasurable loss. So will always control temperature in vegetable growth for the range. If only on artificial control both human consumption, and easy to cause the error. Therefore, in modern management of vegetable shed, usually with temperature automatic control system, to control the vegetables canopy temperature, to adapt to the requirements of production. Single chip microputers are microputer as an important branch, is also a vitality of the model. Single chip microputer hereinafter referred to as the single chip microputer, is particularly applicable to control field, so it is also called the micro controller. Single chip microputer with small size, high level of integration, stable performance, easy to control function expansion, low power consumption, price cheap and so on, so the single chip microputer wide prospect of market. This design is through the singlechip microputer control, to realize the canopy temperature vegetables for automatic control. System based on single chip microputer AT89C52, through the digital and analog temperature in acquisition and detection, through the screen shows the current temperature. When the collected temperature higher than system setting, motors will drive the rotation of the fan, and realize the automatic control the temperature of the shelter. 【 Key words】 Temperature control of the greenhouses system AT89C52 DS18B20 LCD1602 DC motor 1 第 1 章 緒 論 我國(guó)南方溫度嚴(yán)熱而漫長(zhǎng), 只有 大力推廣大棚蔬菜的種植來滿足人們?nèi)粘I顚?duì)蔬菜的需要。溫度過高,蔬菜就會(huì)停止生長(zhǎng)或者糜爛。用數(shù)字溫度計(jì) DS18B20 采集,將采集到的溫度用顯示屏顯示,再根據(jù)采集到的溫度 作分析來 控制馬達(dá)的轉(zhuǎn) 或停 ,從而實(shí)現(xiàn)對(duì)大棚溫度的控制 。近年來電子技術(shù)和信息技術(shù)的飛速發(fā)展,帶來了溫室控制與管理技術(shù)方面的一場(chǎng)革命,隨著“設(shè)施農(nóng)業(yè)”、“虛 擬農(nóng)業(yè)”等新名稱的出現(xiàn)。國(guó)內(nèi)外度計(jì)算機(jī)控制技術(shù)的發(fā)展善計(jì)算機(jī)的發(fā)展最早可以追溯到上個(gè)世紀(jì)的 40年代,但將計(jì)算機(jī)用于環(huán)境控制則開始于 20世紀(jì)60年代。這在給各國(guó)帶來了巨大的經(jīng)濟(jì)效益的同時(shí),也極大 地推動(dòng)了各國(guó)農(nóng)業(yè)的現(xiàn)代化進(jìn)程。該測(cè)控儀具有檢測(cè)精度高、使用簡(jiǎn)單、成本較低和工作穩(wěn)定可靠等特點(diǎn),所以具有一定的應(yīng)用前景。通過 LCD1602液晶顯示屏顯示當(dāng)前溫度,當(dāng) 檢測(cè)到 溫度高于 系統(tǒng)設(shè)定溫度值, 馬達(dá)將帶動(dòng)風(fēng)扇的轉(zhuǎn)動(dòng),實(shí)現(xiàn)自動(dòng)控制