【正文】
體共陰數(shù)碼管引腳圖如圖 8 所示。其引腳圖如圖 9 所示。第 8 腳為 GND,電源地。A1 B2C3E16 E24E35Y0 15Y1 14Y2 13Y3 12Y4 11Y5 10Y6 9Y7 7U174HC138R15k1圖 10 譯碼電路3. 信號功率放大電路為了使 LED 能夠獲得足夠的功率顯示溫度,在本系統(tǒng)中采用了 74HC245 功率放大器,把單片機處理后的溫度數(shù)據(jù)經(jīng)由 74HC245 進行功率放大后,再把它輸入給 LED 數(shù)碼管顯示。如果DIR=“0”G=“0”則 B1 輸入 A1 輸出,其它類同。第 20 腳 VCC,電源正極。電路圖如圖 13 所示。K3K1K2R2R3R4圖 13 溫度設置電路 控制指示電路控制指示電路由兩個彩燈構(gòu)成,由單片機 (引腳 14) 、(引腳 15,見表 1)輸出控制信號,控制彩燈的亮滅。 系統(tǒng)軟件設計 DS18B20 數(shù)據(jù)通信概述 和 DS18B20 通信,其命令序列有 3 步:初始化、ROM 命令(跟隨需要交換的數(shù)據(jù))和功能命令(跟隨需要交換的數(shù)據(jù))。2. ROM 命令在主機檢測到應答脈沖后,就可以發(fā)出 ROM 命令。主機通過重復執(zhí)行搜索 ROM 循環(huán)(搜索 ROM 命令跟隨著位數(shù)據(jù)交換),以找出總線上所有的從機設備。如果該命令用于多節(jié)點,系統(tǒng)則必然發(fā)生數(shù)據(jù)沖突,因為每個從機設備都會響應該命令。例如,主機通過在發(fā)出跳越 ROM 命令后,跟隨轉(zhuǎn)換溫度命令[44h]就可以同時命令總線上所有的 DS18B20 開始轉(zhuǎn)換速度,這樣大大節(jié)省了主機的時間。3. 功能命令在主機發(fā)出 ROM 命令,以訪問某個指定的 DS18B20,接著就可以發(fā)出 DS18B20 的某個功能命令。 (2) 復制 RAM 存儲器(48h) 此命令讀 RAM 存儲器的內(nèi)容,開始讀字節(jié) 0,并繼續(xù)讀到第九個字節(jié)(CRC)。(4)讀電源[B4h] 在此命令送至 DS18B20 之后最先發(fā)出的讀數(shù)據(jù)時間片,器件都會給其電源方式的信號:0=強上拉電阻供電;1=電源供電。 軟件程序設計1) 主程序模塊(如圖 14 所示)。5) 讀取溫度信號值。圖 15 DS18B20 工作流程圖 溫度設定和溫度顯示流程圖分別如圖 12 和圖 13 所示。調(diào)試分三部分進行:片機沒有損壞;;,檢測單片機及其外圍電路能否整體正常工作。步驟二:測試晶振電路是否工作正常。向單 片機錄入以下檢測程序:ORG 0000HLJMP MAINORG 0100HMAIN:CLR AMOV A,AAHMOV P1,AMOV P2,AMOV P3,AAJMP MAINEND該程序的目的是令單片機的 PPP3 端口都輸出 10101010 的八位數(shù)字信號,這時用電壓表測量這三個端口的電平,若得出符合程序的結(jié)果,則可以確定單片機及其外圍電路都能正常工作。3) 編程時要注意,在程序開始時,要寫入各定時器中斷的入口地址。 調(diào)試結(jié)果實物圖如圖 18 所示:圖 18 電路實物圖從實物圖可以看出,溫度控制器能正常顯示溫度值,當超出 1826℃這個溫度范圍時輸出啟動制冷或電暖設備信號。在我即將結(jié)束對課題的研究時,整個系統(tǒng)的硬件和軟件系統(tǒng)已初步成型,并通過了實驗,這與支持我的老師和同學的關(guān)心是分不開的。至此論文完成之際,謹向老師表示由衷的感謝。s lives. Therefore, the number of temperature sensor applications of various sensors of the first home. At present, the temperature sensor is moving from analog to digital integrated direction in the rapid development.This paper provides an overview of temperature controller and the basic principles of development, introduced the principle of temperature sensor and characteristics. Analysis of the merits of the various temperature sensors. On this basis describes the theoretical basis for system development, acquisition, such as temperature part of the circuit design, measurement and some of the key parameters of the system are discussed. At the same time, introducing the function of the temperature control system based on the overall position of the system. Temperature measurement system for collecting, receiving, processing, display part of the overall design of the demonstration program, and further introduced the singlechip applications in the system, analysis of the various parts of the system hardware and software. Proteus carried out the feasibility of using the simulation, the use of Protel DXP 2022 to carry out the circuit schematic drawing and PCB production. This paper describes a singlechip microputer 89C52 as the core temperature of the airconditioning control system. Airconditioning temperature control system design principles to achieve better system performance for the purpose of the pletion of the singlechip data acquisition, processing and display. The system is measured in the general environment to determine the value of the temperature conditions, the use of singlechip microputer to control airconditioning refrigeration and heating system to achieve the required temperature. Preliminary plan is to issue under the ordinary temperature, the system design and choice of devices is also on this basis.Key words: DS18B20 singlechip Temperature Control LED display附錄include include define uchar unsigned chardefine uint unsigned intsbit DS=P3^3。 //定義增溫控制接口sbit dt=P3^5。uchar flag1。//共陰數(shù)碼管 09 空表Unsigned char l_tmpdate[8]={0,0,0,0,0,0,0,0}。uchar tmpread(void)。void zhuti(l_tmp)。void ISR_EX0() interrupt 0 { delayc(2022)。 EA=1。 //溫度轉(zhuǎn)換l_tmp=tmp()。 while((cout%2!=0) amp。amp。 l_tmp=l_tmp+10。 zhuti(l_tmp)。 l_tmp=l_tmp%10。amp。 else dt=1。 else at=1。0xf8。 temp=table[temp]。 P2=0。 while(i0) i。 i=103。 while(i0)i。i++。 dat=DS。}uchar tmpread(void) //讀一個字節(jié){ uchar i,j,dat。i++) { j=tmpreadbit()。 uchar j。j++) { testb=datamp。 i++。while(i0)i。 DS=1。 //初始化 DS18B20 delayb(1)。 uchar a,b。 tmpwritebyte(0xbe)。 temp=8。 //得到真實十進制溫度值,因為 DS18B20 可以精確到 度,所以讀回數(shù)據(jù)的最低位代表的是 度。 //