【正文】
0單線通信功能是分時(shí)完成的,它有嚴(yán)格的時(shí)隙概念,因此讀寫時(shí)序很重要。 指令 1:清顯示,指令碼 01H,光標(biāo)復(fù)位到地址 00H位臵。 馬達(dá)工作的原理 馬達(dá)的旋轉(zhuǎn)原理的依據(jù)為佛來明左手定則,當(dāng)導(dǎo)線臵放于磁場(chǎng)內(nèi),若導(dǎo)線通上電流,則導(dǎo)線會(huì)切割磁場(chǎng)線使導(dǎo)線產(chǎn)生移動(dòng)。 系統(tǒng)通過單片機(jī) AT89C52 控制 ,用 DS18B20數(shù)字溫度傳感器采集溫度。 //LCD 初始化 init_timer0( )。delay_LCM(1000)。 x24c02_write(4,seconde)。 WriteOneChar(0xCC)。 由于 DS18B20轉(zhuǎn)換后的代碼并不是實(shí)際的溫度值,所以要進(jìn)行計(jì)算轉(zhuǎn)換。 TempH=temp4。 //數(shù)據(jù) /命令端 sbit LCM_RW=P2^1。 if(ON_OFF==0) //若溫控標(biāo)志為 0 { DisplayOneChar(14,0,0x4f)。 20 DisplayOneChar(12,1,temp1%10+0x30)。 DisplayOneChar(14,1,temp2/10+0x30)。 WriteCommandLCM(0x0f,1)。 此次畢業(yè)設(shè)計(jì)是我大學(xué)學(xué)習(xí)中遇到過的時(shí)段最長(zhǎng)、涉及內(nèi)容最廣、工作量最大的一次設(shè)計(jì)。它不僅加深了我對(duì)單片機(jī)技術(shù)課程的理解,還讓我感受到了電子設(shè)計(jì)的樂趣。 DisplayOneChar(10,0,seconde%10+0x30)。 DisplayOneChar(4,1,K/10+0x30)。 DisplayOneChar(10,0,seconde%10+0x30)。 //液晶上顯示設(shè)定的溫度 DisplayOneChar(5,1,K%10+0x30)。OUT=1。0x8000) { 開始 提取整數(shù)部分存入HT 提取小數(shù)部分存入 TempL TempL 右移三位 ,將精度降低到 攝氏度 TempH ++ 將小數(shù)部分整數(shù)化 提取符號(hào)部分存入 sign TempL 是否大于 5 temp=?0XF0 RET flag=1 TempH=~TempH+1 Y N N Y 17 str[0]=0x40。所以先將數(shù)據(jù)提取出來,分為三個(gè)部分:小數(shù)部分、整數(shù)部分和符號(hào)部分。 WriteOneChar(0xCC)。 //清零 x24c02_write(8,hour)。 //調(diào)整時(shí)顯示 case 2:displayfun3()。 minite=x24c02_read(6)。 11 第 3 章 系統(tǒng)軟件設(shè)計(jì) 系統(tǒng)電路原理圖 首先對(duì)硬件系統(tǒng) DS18B20 定義端口為 。指令 11:讀數(shù)據(jù)。 第 15 腳:背光源正極。當(dāng)工作于寄生電源時(shí),此引腳必須接地。 DS18B20支持多點(diǎn)組網(wǎng)功能,多個(gè) DS18B20可以并聯(lián)在唯一的三線上,實(shí)現(xiàn)組網(wǎng)多點(diǎn)測(cè)溫。T1 具有方式 0、方式 1 和方式 2 三種工作方式。每一條 I/O線都能獨(dú)立地用作輸入或輸出。 當(dāng)采集到的溫度高于系統(tǒng)設(shè)定值,馬達(dá)將帶動(dòng)風(fēng)扇的轉(zhuǎn)動(dòng),從而降低大棚內(nèi)溫度,實(shí)現(xiàn)自動(dòng)控制大棚里的溫度。 國內(nèi)溫度控制系統(tǒng)的發(fā)展?fàn)顩r 我國對(duì)于溫度測(cè)控技術(shù)的研究較晚,始于 20 世紀(jì) 80 年代。溫度計(jì)算機(jī)控制與管理系統(tǒng)正在不斷吸收自動(dòng)控制和信息管理領(lǐng)域的理論和方法,結(jié)合溫室作物種植的特點(diǎn),不斷創(chuàng)新,逐步完善,從而使溫室種植業(yè)實(shí)現(xiàn)真正意義上的現(xiàn)代化,產(chǎn)業(yè)化。 本設(shè)計(jì)是通過單片機(jī)控制 ,來實(shí)現(xiàn)對(duì)蔬菜大棚溫度進(jìn)行 控制。 【關(guān)鍵詞】溫 度控制 軟件設(shè)計(jì) 溫度采集 降溫處理 Ⅱ Abstract Subject is intelligent temperature control system design based on single chip microputer, this design specific to temperature automatic control o f the vegetable growth of vegetables and temperature are c losely related, for vegetable shed, one of the most important management f actor is the temperature control. Temperature not appropriate, then stop th e vegetable growth or growth slowed, causing the immeasurable loss. There fore, in modern management of vegetable shed, usually with temperature a utomatic control system, to control the vegetables canopy temperature, to adapt to the requirements of production. Single chip microputer with small size, high level of integration, stable performance, easy to control function expansion, low power consum ption, price cheap and so on, so the single chip microputer wide prosp ect of 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 anal og temperature in acquisition and detection, through the screen shows the current temperature. When the collected temperature higher than system set ting, motors will drive the rotation of the fan to reduce the temperature in greenhouses, and realize the automatic control the temperature of the shelte r. Train of thought to design the overall circuit principle diagram, carries on the software design. This design implements the overall control of the greenhouse temperatu re, there are advantages but also have shortings, has certain extensibilit y. 【 Key words】 Temperature control software design temperature data collection Cooling process Ⅲ 目 錄 摘要 ............................................................................................................................... Ⅰ Abstract .......................................................................................................................... Ⅱ 第 1 章 緒 論 ............................................................................................................... 1 課題研究背景和意義 ........................................................................................... 1 國內(nèi)外溫度控制系統(tǒng)的發(fā)展 狀況 .......................................................................... 1 國外溫度控制系統(tǒng)的發(fā)展?fàn)顩r .................................................................... 1 國內(nèi)溫度控制系統(tǒng)的發(fā)展?fàn)顩r .................................................................... 2 課題研究的主 要內(nèi)容 ........................................................................................... 3 第 2 章 系統(tǒng)理論基礎(chǔ)及構(gòu)建 ............................................................................................ 4 AT89C52 的工作原理 ............................................................................................ 4 CPU 的結(jié)構(gòu) ................................................................................................ 4 CPU 的 I/O 口結(jié)構(gòu) ..................................................................................... 4 程序和數(shù)據(jù)存儲(chǔ)器 ..................................................................................... 5 定時(shí)器 ....................................................................................................... 5 中斷系統(tǒng) ...........................................