基于atmega168溫度控制器的軟件設(shè)計(jì).doc
基于atmega168溫度控制器的軟件設(shè)計(jì),基于atmega168溫度控制器的軟件設(shè)計(jì)摘 要溫度是生活和生產(chǎn)中一個(gè)很重要的物理量,在很多領(lǐng)域都要涉及到溫度、如冶金工業(yè)、化工、生產(chǎn)、造紙行業(yè)、機(jī)械制造、電加熱爐及家用電器等,均需要用加熱器來加熱實(shí)驗(yàn)對(duì)象,并對(duì)溫度進(jìn)行測量和控制,使溫度這一被控對(duì)象達(dá)到并保持在某一設(shè)定的溫度范圍內(nèi),即恒溫控制。然而,溫度控制系統(tǒng)具有非...
![](http://img.queshao.com/images/pcgzh.gif)
![](http://preview.queshao.com/tobuy/207433.gif)
內(nèi)容介紹
此文檔由會(huì)員 opopnjf 發(fā)布基于ATmega168溫度控制器的軟件設(shè)計(jì)
摘 要
溫度是生活和生產(chǎn)中一個(gè)很重要的物理量,在很多領(lǐng)域都要涉及到溫度、如冶金工業(yè)、化工、生產(chǎn)、造紙行業(yè)、機(jī)械制造、電加熱爐及家用電器等,均需要用加熱器來加熱實(shí)驗(yàn)對(duì)象,并對(duì)溫度進(jìn)行測量和控制,使溫度這一被控對(duì)象達(dá)到并保持在某一設(shè)定的溫度范圍內(nèi),即恒溫控制。然而,溫度控制系統(tǒng)具有非線性,時(shí)滯以及不確定性。
本次設(shè)計(jì)是基于AVR系列單片機(jī)ATmega168設(shè)計(jì)一種溫度控制器,其特點(diǎn)是具有液晶顯示,溫度在0℃到30℃范圍可調(diào),并具有RS485總線接口,可以與上位機(jī)進(jìn)行數(shù)據(jù)通信。其軟件方面的功能包括:系統(tǒng)初始化、液晶顯示驅(qū)動(dòng)程序設(shè)計(jì)、按鍵和燃燒指示信號(hào)采集程序、溫度測量程序設(shè)計(jì)、控制邏輯的實(shí)現(xiàn)以及基于RS485串行的Modbus協(xié)議的實(shí)現(xiàn)等。
通過程序編寫和上機(jī)調(diào)試,實(shí)現(xiàn)了對(duì)溫度系統(tǒng)的控制要求。設(shè)計(jì)的軟件可以完成:對(duì)系統(tǒng)進(jìn)行初始化;液晶顯示;采集按鍵和燃燒指示信號(hào)并進(jìn)行反饋報(bào)警;測量環(huán)境溫度并進(jìn)行溫度控制等功能。
關(guān)鍵詞:溫度控制系統(tǒng) ATmega168單片機(jī) I2C總線 Modbus協(xié)議
ABSTRACT
The temperature is life and production in a very important physics, in many areas to want to involve temperature, such as metallurgy industry, chemical industry, the production, the paper industry, machinery manufacturing, electric heating and household electric appliances, etc, all need to use the heater to heating experimental object and temperature measuring and control the temperature, the controlled object to attain and maintain a set in the temperature range, namely constant temperature control. However, the temperature control system with nonlinear, delay and uncertainty
Based on the AVR series of SCM ATmega168 to design a gas radiant heating controller is the purpose of this design. Its characteristics are having a LCD, temperature range from 0 ℃ to 30 ℃ adjustable, having a bus interface with RS485, and being able to carry out data communication with PC. The software features include system initialization, LCD driver, buttons and burning direct signal acquisition program, temperature measurement program, the implementation of control logic and the implementation of Modbus protocol which is based on the serial RS485, etc.
Through programming and the debugging, the control requirements of gas radiant heating system are realized. The software can complete jobs as followed: system initialization, LCD, collecting buttons and burning direct signal and having the feedback alarms for burning direct signal, measuring temperature and controlling it, etc.
Keywords: temperature control system SCM of ATmega168 I2C bus Modbus protocol
目 錄
1 前 言 1
2 單片機(jī)及相關(guān)協(xié)議 2
2.1 ATmega168單片機(jī)介紹 2
2.1.1 ATmega168單片機(jī)簡介 2
2.1.2 AVR CPU內(nèi)核 2
2.1.3 系統(tǒng)時(shí)鐘 4
2.1.4 兩線串行接口 5
2.2 I2C總線協(xié)議 6
2.2.1 I2C總線的概念 6
2.2.2 I2C總體特征 6
2.2.3 I2C總線規(guī)范 7
2.2.4 位傳輸 7
2.2.5 傳輸數(shù)據(jù) 8
2.2.6 7位尋址 9
2.3 Modbus協(xié)議 9
2.3.1 Modbus協(xié)議介紹 9
2.3.2 串行傳輸 11
2.3.3 Modbus信息幀 12
2.3.4 地址設(shè)置 12
2.3.5 功能碼 13
2.3.6 數(shù)據(jù)區(qū)的內(nèi)容 13
2.3.7 錯(cuò)誤校驗(yàn) 13
2.3.8 本控制器使用的Modbus功能代碼 13
3 編程及仿真軟件 17
3.1 ICCAVR軟件 17
3.1.1 ICCAVR軟件簡介 17
3.1.2 ICCAVR的IDE環(huán)境 17
3.2 AVRStudio軟件 17
4 控制器軟件設(shè)計(jì) 18
4.1 LCD驅(qū)動(dòng)和按鍵處理程序 20
4.1.1 顯示器顯示控制 20
4.1.2 段碼驅(qū)動(dòng)程序 21
4.1.3 液晶驅(qū)動(dòng)控制 22
4.1.4 按鍵控制程序 23
4.1.5 控制功能實(shí)現(xiàn)程序 25
4.1.6 報(bào)警和消音邏輯程序 28
4.1.7 按鍵切換程序 30
4.1.8 綜合狀態(tài)處理程序 31
4.2 I2C功能實(shí)現(xiàn) 34
4.3 Modbus協(xié)議功能實(shí)現(xiàn) 36
4.3.1 基本功能 36
4.3.2 檢查UART0數(shù)據(jù) 39
4.4 初始化子程序 41
4.5 時(shí)間任務(wù)與處理 42
4.5.1 時(shí)間標(biāo)志實(shí)現(xiàn) 42
4.5.2 任務(wù)處理 43
4.6 系統(tǒng)主程序 43
5 軟件調(diào)試 44
結(jié) 論 45
謝 辭 46
參考文獻(xiàn) 47
TA們正在看...
- 七年級(jí)數(shù)學(xué)上--絕對(duì)值練習(xí)及提高習(xí)題.doc
- 七年級(jí)數(shù)學(xué)上-豐富的圖形世界-知識(shí)點(diǎn)匯總.doc
- 七年級(jí)數(shù)學(xué)上冊(cè)-整式及其加減資料.doc
- 七年級(jí)數(shù)學(xué)上冊(cè)-第五章一元一次方程同步練習(xí)題.doc
- 七年級(jí)數(shù)學(xué)上冊(cè)1.1正數(shù)和負(fù)數(shù)課件1新版資料教版.ppt
- 七年級(jí)數(shù)學(xué)上冊(cè)1.5.2科學(xué)計(jì)數(shù)法教案新版資料教版.doc
- 七年級(jí)數(shù)學(xué)上冊(cè)_第一章豐富的圖形世界全部教案_北...doc
- 七年級(jí)數(shù)學(xué)上冊(cè)一元一次方程測試卷及答案.doc
- 七年級(jí)數(shù)學(xué)上冊(cè)應(yīng)用題類型.doc
- 七年級(jí)數(shù)學(xué)上冊(cè)思維導(dǎo)圖76006.doc