【正文】
1 廣州大學松田學院 畢業(yè)論文(設計) 題目 ___ 基于單片機的溫控報警器設計 ____ 2 基于單片機的溫控報警器設計 摘要: 溫度是我們日常生產和生活中實時接觸到的物理量,但是它是看不到的,僅憑感覺只能感覺到大概的溫度值,傳統(tǒng)的指針式的溫度計雖然能指示溫度,但是精度低,使用不夠方便,顯示不夠直觀,數字溫度計就應運而生了,利用數字讓人們更加直觀的了解自己想知道的溫度到底是多少。 所以,溫度的測量是一個很重要的物理參數,它能直接告訴人們所需要的溫度的大小。隨著世界的科 技發(fā)展,對于溫度的測量要求也是越來越嚴格了,但是測量溫度的環(huán)境也越來越惡劣。溫度的測量不僅僅局限于外出穿衣的指標上了,在現實的社會中,溫度的測量和控制無處不在,例如家庭里面都能看見的冰箱的自動溫度調節(jié)。但是很多時候,在惡劣的環(huán)境中的測量則會受到很大程度的限制,尤其在工業(yè)控制中,在這個時候,溫度測量的自動控制先得尤為重要。 本文將要介紹的是和采用 DS18B20作為溫度傳感器,自動測量當前溫度,由單片機 avr mega16 進行處理控制,并通過 lCD1602 顯示設定溫度和當前溫度,若當前溫度超過設定溫度,系統(tǒng)將會 進行比較簡單的聲光報警。 關鍵詞: DS18B20, lCD1602, 單片機, 聲光報警 3 Temperature alarm design based on SCM Abstract: The temperature is realtime access to the physical quantities in our daily production and life, but it can not see, just by feeling it probably only feel the temperature values, traditional pointer thermometer indicates that the temperature, but low accuracy, use is not convenient enough, the display is not intuitive, digital thermometer is made using digital more intuitive understanding of the temperature in the end they want to know is how much. Therefore, the temperature measurement is a very important physical parameters can directly tell people the size of the required temperature. With the development of science and technology of the world, for the temperature measurement requirements bee increasingly stringent, measure the temperature of the environment is also worsening. Temperature measurement is not limited to the indicators go out dressed in the reality of the society, the measurement and control of temperature everywhere, for example, the family can see inside the refrigerator thermostat. But many times, in the harsh environment of the measurement will be subject to a large degree of restriction, especially in industrial control, at this time, the automatic control of the temperature measuremente particularly important. This article is DS18B20 as the temperature sensor and the use of automatic measurement of the current temperature, to be processed by the microcontroller avr mega16 control displays the set temperature and the current temperature and through lCD1602 to, if the temperature exceeds the set temperature, the system will be relatively simple the sound and light alarm. Keywords: SCM, DS18B20, lCD1602, sound and light alarm 4 目錄 1 緒論 .............................................................................................................. 6 課題的背景 ........................................................................................ 6 課題的意義 ........................................................................................ 6 研究的基本內容與擬解決的主要問題 ............................................ 7 研究的基本內容 ......................................................................... 7 擬解決的主要問題 ..................................................................... 8 2 設計的思路 .................................................................................................. 8 設計基本原理 .................................................................................... 8 設計的基本條件 ................................................................................ 9 溫度報警器的技術和工作原理 ........................................................ 9 DS18B20 溫度傳感器介紹 ......................................................... 9 DS18B20 的初始化 ................................................................... 10 DS18B20 的寫操作 ................................................................... 10 DS18B20 的讀操作 ................................................................... 11 DS18B20 內部結構圖 ............................................................... 11 DS18B20 工作原理 ................................................................... 11 液晶顯示屏 LCD1602 主要參數技術 ............................................ 12 引腳接口說明表 ....................................................................... 12 LCD1602 的指令說明及時 序 ..................................................... 13 Atmega16 單片機介紹 ....................................................................... 13 3 系統(tǒng)硬件設計 ............................................................................................ 13 溫度傳感器設計 .............................................................................. 13 液晶 LCD1602 顯示部分設計 ........................................................ 14 單片機 ATmega16 原理圖設計 ...................................................... 15 程序燒寫 ................................................................................... 16 電源端口 ................................................................................... 16 串口通訊端的設計 ................................................................... 16 報警設計 ................................................................................... 17 5 按鍵設計 ................................................................................... 17 4 系統(tǒng)軟件設計 ............................................................................................ 18 流程圖 .............................................................................................. 18 5 溫度數據處理函數 .................................................................................... 19 DS18B20 初始化函數 ........................................................................ 19 傳感器 DS18B20 的子函數 ............................................................ 19 傳感器 DS18B20 寫命令子函數 ............................................. 20 DS18B20 讀一個字節(jié)數據子函數 ........................................... 21 LCD1602 顯示函數 ............................................................................ 23 LCD1602 初始化子函數 ........................................................... 23 LCD1602 寫數據子函數 ........................................................... 24 LCD1602 寫命令子函數 .......