【正文】
ve, to enlarge current transistor. When the temperature is below six degrees Celsius, alarm. ( 5) Fan circuit When the temperature is higher than 80 176。XTAL2: Output from the inverting oscillator amplifier. EA/VPP: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. 中原工學(xué)院信息商務(wù)學(xué)院外文 翻譯 12 Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12volt programming enable voltage (VPP) during Flash programming, for parts that require 12volt VPP. ALE/ PROG : Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input ( PROG ) during Flash programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALEdisable bit has no effect if the microcontroller is in external execution mode. Port 3: Port 3 is an 8bit bidirectional I/O port with internal pull ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull ups. Port 3 also receives some control signals for Flash programming and verification. Port 1: Port 1 is an 8bit bidirectional I/O port with internal pull ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull ups. Port 1 also receives the loworder address bytes during Flash programming and verification. 中原工學(xué)院信息商務(wù)學(xué)院外文 翻譯 11 GND: Ground Lowpower idle and Powerdown modes Function Characteristic Description: The AT89C51 provides the following standard features: 4K bytes of Flash memory, 128 bytes of RAM, 32 I/O lines, two 16bit timer/counters, a five vector twolevel interrupt architecture, a full duplex serial port, onchip oscillator and clock circuitry. In addition, the AT89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Powerdown Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. Pin Description: Six interrupt source 32 programmable I/O lines Threelevel program memory lock Endurance: 1000 write/erase cycles Compatible with instruction set of MCS51 products 在諸如糧庫測溫、智能建筑、中央空調(diào)等多種需要溫度檢測的場合具有較好的應(yīng)用前景。因此。說明了系統(tǒng)硬件電路、系統(tǒng)主程序與各模塊子程序的設(shè)計。 五、小結(jié) 隨著工業(yè)的不斷發(fā)展,對溫度測量的要求來越高,而且測量范圍也越來越廣,因此對溫度檢測技術(shù)的要求也越來越高。 四、系統(tǒng)的軟件設(shè)計 本系統(tǒng)采用 AT89C51 作為核心處理器件,把經(jīng)過 DSl8B20 現(xiàn)場實時采集到的溫度數(shù)據(jù) ,存入 AT89C51 的內(nèi)部數(shù)據(jù)存儲器,送液晶顯示,并與預(yù)先設(shè)定值進行比較,然后由單片機輸出信號去控制風(fēng)扇電路和報警電路。因為工作電流比較大,所以用放大電路來驅(qū)動,即用三極管來放大電流就可以了。當所測的溫度低于 6 攝氏度時,報警。 LCD1602 液晶屏 1602 液晶顯示模塊可以和單片機 AT89C51 直接接口。在 A89S52 的 I/O 口線與 +5V 之間連接一 的上拉電阻,以保證數(shù)據(jù)采集的正常進行。 本系 統(tǒng)采用外部電源方式。要想使 DS18B20 進行精確的溫度轉(zhuǎn)換, I/O 線必須保證在溫度轉(zhuǎn)換期間提供足夠的能量,由于每個 DS18B20 在溫度轉(zhuǎn)換期間工作電流達到 1mA,當幾個溫度傳感器掛在同一根 I/O 線上進行多點測溫時,只靠 上拉電阻就無法提供足夠的能量,會造成無法轉(zhuǎn)換溫度或溫度誤差極大。 2)可以在沒有常規(guī)電源的條件下讀取 ROM。 寄生電源方式:在寄生電源供電方式下, DS18B20 從單線信號線上汲取能量:在信號線 DQ 處于高電平期間把能量儲存在內(nèi)部電容里,在信號線處于低電平期間消耗電容上的電能工作,直到高電平到來再給寄生電源(電容)充電。圖 中的斜率累加器用于補償和修正測溫過程中的非線性,其輸出小于修正計數(shù)器 l 的預(yù)置值。計數(shù)器 計數(shù)器 2 和溫度寄存器被預(yù)置在 55℃ 所對應(yīng)的一個基數(shù)值。高溫度系數(shù)晶振隨溫度變化其振 蕩頻率明顯改變。 ( 1) DSl8B20 的工作原理 DS18B20 的內(nèi)部結(jié)構(gòu) DSl8B20 的測溫原理框圖如圖 所示。 (8)用戶可設(shè)定溫度報警門限值。 (7)9 位的溫度分辨率。(6)支持多點組網(wǎng)功能。 (4)可用數(shù)據(jù)線供電,電壓范圍從 到 。 (2)多點功能簡化了分布式溫度檢測的應(yīng)用。因此,在溫度測量系統(tǒng)中,采用抗干擾能力強的新型數(shù)字溫度傳感器是解決這些問題的最有效方案, 與其它溫度傳感器相比DSl820 具有以下特點: (1)獨特的單線接口方式。 傳感器的介紹 在傳統(tǒng)的模擬信號遠距離溫度測量系統(tǒng)中,需要很好的解決引線誤差補償問題、多點測量切換誤差問題和放大電路零點漂移誤差問題等技術(shù)問題,才能夠達到較高的測量精度。 芯片擦除: 利用控制信號的正確組合并保持 ALE/PROG 引腳 10ms 的低電平脈沖寬度即可將PEROM 陣列( 4K 字節(jié))和三個加密位整片擦除,代碼陳列在片擦除操作中將任何非空單元寫入“ 1”,這步驟需再編程之前進行。 程序校驗: 如果加密位 LB LB2 沒有進行編程,則代碼數(shù)據(jù)可通過地址和數(shù)據(jù)線讀回原編寫的中原工學(xué)院信息商務(wù)學(xué)院外文 翻譯 6 數(shù)據(jù)。 數(shù)據(jù)查詢: AT89C51 單片機用數(shù)據(jù)查詢方式來檢測一個寫周期是否結(jié)束,在一個寫周期中,如需讀取最后寫入的那個字節(jié),則讀出的數(shù)據(jù)最高位是原來寫入字節(jié)最高位的反碼。改變編程單元的地址和寫入的數(shù)據(jù),重復(fù) 1— 5步驟,直到全部文件編程結(jié)束。 在高電壓編程方式時,將 EA/VPP端加上 +12V 編程電壓。 在數(shù)據(jù)線上加上要寫入的數(shù)據(jù)字節(jié)。 編程方法: 編程前,須根據(jù)表設(shè)置好地址、數(shù)據(jù)及控制信號。低電壓編程模式適合于用戶在線編程系統(tǒng),而高電壓編程模式可與通用 EPROM 編程器兼容。 Flash 閃速存儲器的編程: AT89C51 單片機內(nèi)部有 4K 字節(jié)的 Flash PEROM,這個 Flash 存儲陣列出廠時已處于擦除狀態(tài)(即所有存儲單元的內(nèi)容均為 FFH),用戶隨時可對其進行編程。為使單片機能 正常工作,被鎖存的 EA電平值必須與該引腳當前的邏輯電平一致。退出掉電模式的唯一方法是硬件復(fù)位,復(fù)位后將重新定義全部特殊功能寄存器但不改變 RAM 中的內(nèi)容,在 VCC 恢復(fù)到正常工作電平前,復(fù)位應(yīng)無效,且必須保持一定時間以使振蕩器重啟動并穩(wěn)定工作。為了避免可能對端口產(chǎn)生意外寫入,激活空閑模式的那條指令后一條指令不應(yīng)是一條對端口或外部存儲器的寫入指令。 通過硬件復(fù)位也可將空閑工作模式終止。此時,片內(nèi) RAM 和所有特殊功能寄存器的內(nèi)容保持不變。 由于外部時鐘信號是通過一個 2 分頻觸發(fā)器后作為內(nèi)部時鐘信號的,所以對外部時鐘信號的占空比沒有特殊要求,但最小高電平持續(xù)時間和最大的低電平持續(xù)時間應(yīng)符合產(chǎn)品技術(shù)條件的要求。 用戶也可以采用外部時鐘。 時鐘振蕩器: AT89C51 中有一個用于構(gòu)成內(nèi)部振蕩 器的高增益反相放大器,引腳 XTAL1 和 XTAL2分別是該放大器的輸入端和輸出端。 Ready/BUSY :字節(jié)編程的進度可通過 RDY/BSY 輸出信號監(jiān)測,編程期間, ALE 變?yōu)楦唠娖健?H”后 ( RDY/BSY )端電平被拉低,表示正在編程狀態(tài)(忙狀態(tài))。 XTAL1:振蕩器反相放大器及內(nèi)部時鐘發(fā)生器的輸入端。如 EA 端為高電平(接 VCC 端), CPU 則執(zhí)行內(nèi)部程序存儲器中的指令。欲使 CPU 僅訪問外部程序存儲器(地址為 0000H— FFFFH),EA 端必須保持低電平(接地)。在此期間,當訪問外部