【正文】
tor is frozen, all the work to stop until the next interruption or hardware reset. ( 2) The sensor DS18B20 5 In the traditional analog signal distance temperature measuring system, need good solve lead error pensation, multipoint measurement error and amplifying circuit switching technologies such as zero drift error problem, can achieve high measuring accuracy. Another general monitoring site of the electromagic environment is very bad, all kinds of jamming signal is stronger, the simulated temperature signal interference and vulnerable to produce measurement error and measuring precision [5]. Therefore, in temperature measuring system, the strong antijamming capability of the new digital temperature sensor is the most effective to solve these problems, pared with other temperature sensor DSl820 has the following features: (1) the unique singleline interface way. DSl820 in connection with the microprocessor only need one interface to implement line DSl820 microprocessors and twoway munication. (2) more function simplifies distributed temperature detection application. (3) DSl820 in use without any peripheral devices. (4) power, voltage range data available from V to V. (5) can measure temperature range from 55 degrees c + + to 125, incremental value 0. 5 176。該系統(tǒng)具有硬件電路結構簡單、轉換精度高、顯示結果清晰穩(wěn)定、成本低等顯著優(yōu)點。本系統(tǒng)采用的是 DALLAS 公司推出的數(shù)字式 溫度傳感器DS18B20,無需外加 A/ D 即可輸出數(shù)字量,把溫度信號直接轉換成串行數(shù)字信號供微機處理。 本文介紹了以 DSl8B20 新型數(shù)字溫度傳感器、 AT89S52 單片機、 LCD1602 液晶顯示模塊為主體構建的溫度檢測顯示系統(tǒng)。多功能溫度檢測顯示系統(tǒng)軟件主要包括:函數(shù)聲明、延遲時間函數(shù)、 DS18B20 初始化函數(shù)、讀出DS18B20 當前的溫度、溫度數(shù)據轉化成液晶字符顯示等程序 。當溫度高于 80℃ 時,給單片機一個命令,單片機 P2. 6 引腳輸出高電平,三極管導通,風扇電路接通,電風扇開始轉動,從而起到降溫作用。 風扇電路 當所測的溫度高于 80 攝氏度時,啟動風扇電路。 蜂鳴器驅動電路 由于蜂鳴器的工作電流一般比較大,以致于單片機的 I/O 口是無法直接驅動的,所以要利用放大電路來驅動,一般使用三極管來放大電流就可以了。若要組成多點溫度檢測系統(tǒng),可在單片機的同一根 I/O 口線上,以相同的連接方法并聯(lián)多片 DS18B20 芯片。連接方法即 DS18B20 的 1 腳接地 ,2 腳 (DQ 引腳 )與 AT89S52 的一根 I/O 口線相連 ,3 腳接 +5V。 外部電源供電方式:在外部電源供電方式下, DS18B20 工作電源由 VDD 引腳接入,此時 I/O 線不需要強上拉,不存在電源電流不足的問題,可以保證轉換精度,同時在總線上理論可以掛接任意多個 DS18B20 傳感器,組成多點測溫 3 系統(tǒng)。 3)電路更加簡潔,僅用一根 I/O 口實現(xiàn)測溫。寄生電源方式有三個好處: 1)進行遠距離測溫時,無需本地電源。 ( 2) DS18B20 與 AT89S52 的接口方式 DS18B20 與單片機的連接方式有兩種:即寄生電源方式 和外部電源方式。計數(shù)器 l 對低溫度系數(shù)晶振產生的脈沖信號進行減法計數(shù),當計數(shù)器 1 的預置值減到 O 時,溫度計數(shù)器的值將加 l,計數(shù)器 l 的預置值將被重新裝人,計數(shù)器 l 重新開始對低溫度系數(shù)晶振產生的脈沖信號進行計數(shù),如此循環(huán)直到計數(shù)器 2 計數(shù)到 O 時,停止溫度寄存器的累加,此時溫度寄存器中的數(shù)值即為所測溫度。所產生的信號作為計數(shù)器2 的脈沖輸入。圖中低溫度系數(shù)品振的振蕩頻率受溫度影響很小,用于產生同定頻率的脈沖信號送給計數(shù)器l。 (9)有超溫度搜尋功能。測量結果以 9 位數(shù)字量方式串行傳送。 多個 DS1820 可以并接在同一條總線上 ,實現(xiàn)多點測溫。 (5)可測量的溫度范圍從 55℃ 到 +125℃ ,增量值 0. 5℃ ;華氏溫度范圍從 67 到 +257,增量值 0. 9。 (3)DSl820 在使用中無需任何外圍元件。 DSl820 在與微處理器連接時僅需要一條接口線即可實現(xiàn)微處理器與 DSl820 的雙向通訊。另外一般監(jiān)控現(xiàn)場的電磁環(huán)境都非常惡劣,各種干擾信號較強,模擬