【正文】
................................................................ 1 課題背景及研究意義 ............................................................................... 1 國內(nèi)外研究和應(yīng)用現(xiàn)狀 ........................................................................... 1 課題研究內(nèi)容 ........................................................................................... 2 第 2 章 系統(tǒng)設(shè)計的總體方案 ............................................................................ 4 設(shè)計要求 ................................................................................................... 4 系統(tǒng)總體方案論述 ................................................................................... 4 主控單片機 ........................................................................................ 4 溫度傳感器 ........................................................................................ 6 LCD 顯示器 ........................................................ 錯誤 !未定義書簽。 關(guān)鍵詞 溫度采集 ; DS18B20; STC 單片機;測試程序 ;超溫報警電路 哈爾濱理工大學(xué)學(xué)士學(xué)位論文 II Based on STC single chip microputer temperature control system design Abstract Along with the puter measurement and control technology of the rapid development and wide application, the application of SCM is to keep at the same time, traditional control testing update on Crescent benefits. In realtime detection and automatic control system of singlechip applications, often as a singlechip core ponent to use only singlechip is not enough knowledge, but also the specific hardware structure and the specific features of application software objects bine to make perfect. The theme of this design is based on the STC singlechip temperature control system experiment of temperature control system based on STC control unit and the temperature measuring unit consisting of a single bus digital temperature sensor DS research 18B20. The system can be expected to detect the preset temperature, display time and save monitoring data. An alarm will be given by system if the temperature exceeds the upper and lower limit value of the temperature which can be set discretionarily and then automatic control is achieved, thus the temperature is achieved monitoring intelligently within a certain range. The system design of the hardware circuit and the related applications. The hardware circuit including STC12C5A60S2MCU minimum system, a temperature measurement circuit, clock circuit, LCD display circuit, alarm circuit and a munication module circuit. System program, including the main program, a DS18B20 munication program, key program, LCD display program and data storage procedure. Microcontroller as the core temperature acquisition and control system development and application has greatly improved the production life of the temperature control level, at the same time through the test results show that the design of the system is accurate,and 哈爾濱理工大學(xué)學(xué)士學(xué)位論文 III feasible. Keywords Temperature acquisition。 系統(tǒng)設(shè)計了相關(guān)的硬件電路和相關(guān)應(yīng)用程序。 在實時檢測和自動控制的單片機應(yīng)用系統(tǒng)中,單片機往往是作為一個核心部件來使用, 但僅 僅單片機方面知識是不夠的,還應(yīng)根據(jù)具體硬件結(jié)構(gòu),以及具體應(yīng)用對象特點的軟件結(jié)合,以作完善 。 本次設(shè)計的主題是基于 STC 單片機的溫度調(diào)控系統(tǒng)設(shè)計 , 此次設(shè)計的溫度控制系統(tǒng)主要是對 以 STC 單片機為主控制單元和以溫度測量單元構(gòu)成的單總線數(shù)字溫度傳感器 DS18B20 進行研究。硬件電路主要包括STC12C5A60S2 單片機最小系統(tǒng) 、 測溫電路、實時時鐘電路、 LCD 液晶顯示電路、超溫報警電路以及通訊模塊電路等。 DS18B20。 系統(tǒng)調(diào)試所用軟件簡述 ........................................................................... 7 KEIL 軟件簡介 ................................................... 錯誤 !未定義書簽。傳統(tǒng)的繼電器調(diào)溫電路簡單實用 , 但由于繼電器動作頻繁 ,可能會因觸點不良而影響正常工作。由于 DS18B20 芯片的小型化 ,更加可以通過單跳數(shù)據(jù)線就可以和主電路連接,故可以把數(shù)字溫度傳感器DS18B20 做成探頭,探入到狹小的地方,增加了實用性。先是采用模擬式的組合儀表,采集現(xiàn)場信息并進行指示、記錄和控制。 我國對于溫度測控技術(shù)的研究較晚,始于 20 世紀(jì) 80 年代。我國溫度測量控制現(xiàn)狀還遠遠沒有達到工廠化的程度,生產(chǎn)實際中仍然有許多問題困擾著我們,存在著裝備配套能力差,產(chǎn)業(yè)化程度低,環(huán)境控制水平落后,軟硬件資源不能共享和可靠性差等缺點。不過,模糊控制系統(tǒng)動態(tài)性能好,單穩(wěn)定性較差,而且很難使兩種性能都達到理想要求。 基于 STC12C5A60S2單片機, DS18B20將檢測到的溫度信號數(shù)字信號,并將信號送入單片機進行處理。此外,時鐘芯片 DS 1302是用來顯示時間和外部 的 6264是用來保存數(shù)據(jù)。 ① 溫度檢測及控制電路部分 本系統(tǒng)中溫度檢測電路選用美國 DALLAS公司生產(chǎn)的一線數(shù)字溫度傳哈爾濱理工大學(xué)學(xué)士學(xué)位論文 3 感器 DS18B20實現(xiàn)。在 DS18B20內(nèi)部,提供 0. 125℃ 的 高分辨率的計算,溫度以16位符號擴展的二進制補碼的形式存于溫度寄存器中。在本設(shè)計中 P0口和 P1口的部分位,作為動態(tài)顯示器的顯示輸出口。在開機后輸入設(shè)定溫度值即可。 DS 18B20的主要數(shù)據(jù)原件有: 64位激光 Lasers ROM,溫度靈敏原件和非易失性溫度報警觸發(fā)器 TH和 TL。 。該控制系統(tǒng)可以實時存儲相關(guān)的溫度數(shù)據(jù)并記錄當(dāng)前的時間。該單片機屬于雙列直插式封裝,有 4 組 8 位 I/O 口, P P P3 屬于準(zhǔn)雙向口,可作為普通輸入輸出 STC12C5A60S2 單片機 按鍵處理 溫度采集 輸入電源 數(shù)據(jù)存儲 超溫報警 LCD 顯示 哈爾濱理工大學(xué)學(xué)士學(xué)位論文 5 IO 口, P0 口接上拉電阻后可作為普通 I/O 口使用。 晶振電路 : 晶振是晶體振蕩器的簡稱,在電氣上它可以等效成一個電容和一個電阻并聯(lián)再串聯(lián)一個電容的二端網(wǎng)絡(luò),電工學(xué)上這個網(wǎng)絡(luò)有兩個諧振點,以頻率的高低分其中較低的頻率是串聯(lián)諧振,較高的頻率是并聯(lián)諧振。 一般的晶振振蕩電路都是在一個反相放大器(注意是放大器不是反相器)的兩端接入晶振,再有兩個電容分別接到晶振的兩端,每個電容的另一端再接到地,這兩個電容串聯(lián)的容量值就應(yīng)該等于負(fù)載電容, 請注意一般 IC 的引腳都有等效輸入電容,這個不能忽略。主要根據(jù)應(yīng)用場合的不同而改變其外觀。 圖 外部供電方式的多點測溫電路圖 LCD 顯示器 在此設(shè)計中需要顯示設(shè)定溫度的上下限 , 并且還要同時顯示多路溫度傳感器所測得溫度值 , 所以此次的 LCD 顯示器選用的是 12864 型號 。由該模塊構(gòu)成的液晶顯示方案與同類型的圖形點陣液晶顯示模塊相比,不論硬件電路結(jié)構(gòu)或顯示程序都要簡潔得多,且該模塊的價格也略低于相同點陣的圖形液晶模塊。 Keil 軟件簡介 Keil C51 是美國 Keil Software 公司出品的 51 系列兼容單片機 C 語言軟件開發(fā)系統(tǒng),與匯編相比, C 語言在功能上、結(jié)構(gòu)性、可讀性、可維護性上有明顯的優(yōu)勢,因而易學(xué)易用。 Keil C51 軟件提供豐富 的庫函數(shù) 和功能強大的集成開發(fā)調(diào)試工具, 全 Windows 界面。開發(fā)人員可用 IDE 本身或其它 它 編輯 編輯器 C 或匯編源文件。 Keil 軟件調(diào)試過程 單片機開發(fā)中除必要的硬件外,同樣離不開軟件。 圖 KEIL 調(diào)試文件建立 哈爾濱理工大學(xué)學(xué)士學(xué)位論文 9 工程的建 立:建立一個 .C 的文件 , 同時再建立一個和前面的文件名一樣的文件夾 ,選擇好 CPU, 使用 STC12C5A60S2, 同時設(shè)好晶振頻率 , 我們用的是 12MHZ, 如 上 圖 。等所以硬件都無誤之后,將所有程序模塊整合起來就可以實現(xiàn)所要的功能 。 本章小結(jié) 本章主要論述了此次設(shè)計系統(tǒng)的總體結(jié)構(gòu) , 并簡單介紹了設(shè)計中使用的單片機 , 溫度傳感器等元件的電路連 接 , 最后還介紹了系統(tǒng)調(diào)試時所使用的軟件及調(diào)試過程 , 本章主要是總體的論述一番 , 為后面的設(shè)計做好鋪墊 。 : STC12C5A60S2 系列工作電壓: ( 5V 單片機)STC12C5A60S2 系列工作電 壓: ( 3V 單片機) 。 EEPROM 功能 (STC12C5A62S2/AD/PWM 無內(nèi)部 EEPROM) 哈爾濱理工大學(xué)學(xué)士學(xué)位論文 11 。 (2 路) /PCA(可編程計數(shù)器陣列 , 2 路) 也可用來當(dāng) 2 路D/A 使用 也可用來再實現(xiàn) 2 個定時器 也可用來再實現(xiàn) 2 個外部中斷(上升沿中斷 /下降沿中斷均可分別或同時支持 ) 。I/O 口不夠時,可用 2 到 3 根普通 I/O 口線外接 。 STC12C5A60S2 系列 單片機 的優(yōu)點 , 1 個時鐘 /機器周期 , 可用低頻晶振 , 大幅降低 EMI : INT0/, INT1/, T0/, T1/, RxD/,CCP0/(或 ),CCP1/(或 ), EX_LVD/ : 掉電模式 :外部中斷喚醒功耗 , 支持下降沿 /上升 沿 /低電平和遠程喚醒適用于電池供電系統(tǒng) , 如水表 , 氣表 , 便攜設(shè)備等 空閑模式 , 正常工作模式