【正文】
C. At the same time, the counter is then preset with a value determined by the slope accumulator circuitry. This circuitry is needed to pensate for the parabolic behavior of the oscillators over temperature. The counter is then clocked again until it reaches zero.If the gate period is still not finished, then this process repeats. The slope accumulator is used to pensate for the non–linear behavior of the oscillators over temperature, yielding a high resolution temperature measurement. This is done by changing the number of counts necessary for the counter to go through for each incremental degree in temperature. To obtain the desired resolution, therefore, both the value of the counter and the number of counts per degree C (the value of the slope accumulator) at a given temperature must be known.Internally, this calculation is done inside the DS1820 to provide 176。在指導(dǎo)老師的悉心輔導(dǎo)下和查閱大量資料之后,然后采用了STC12C5410AD數(shù)據(jù)采集芯片并配合其它一些元器件的硬件設(shè)計方案,使以上問題得到了很好解決 。(2).LED的靜態(tài)顯示 LED的靜態(tài)顯示就是在LED上送入待顯示的內(nèi)容后,LED的管腳的狀態(tài)一直保持不變,即在LED上穩(wěn)定靜止的顯示出待顯示的內(nèi)容,該種設(shè)計軟件編寫簡單,單片機軟件資源占用少,但相應(yīng)的在沒加輔助顯示芯片,使電路復(fù)雜,I/O口占用過多。如果前面比較的結(jié)果值還是小于零,說明該振蕩頻率f不在該段,就把比較次數(shù)f加1后,從表中再次取值,繼續(xù)進行的比較,直至比較結(jié)果大于零。然后把頻率曲線上相鄰的兩點依次用直線相連,就得到一條新的濕度頻率曲線,它與實際曲線幾乎重合在一起,所以可以使用該曲線產(chǎn)生進行線性化處理。當(dāng)相對濕度值升高時,振蕩器輸出頻率會隨之降低,而且它們之間的這種變化是非線性的。當(dāng)AD轉(zhuǎn)換器將采樣的電壓值轉(zhuǎn)變?yōu)閿?shù)字值后,單片機將這個數(shù)字值進行簡單的處理就可以得到要檢測的溫度值,本設(shè)計將溫度對電壓的變化大體堪為近似的線性關(guān)系,把采集到的數(shù)字量是將5V的電壓分成1024個等分,則每變化一個溫度就可以對應(yīng)一個數(shù)字電壓量的變化,就可以通過這個數(shù)字量直接對應(yīng)出環(huán)境溫度,當(dāng)然這里的溫度值是熱力學(xué)溫度值,還要進一步的轉(zhuǎn)化常用的攝氏度溫度來顯示。儀表的應(yīng)用軟件根據(jù)KT=(T1T2)/(V1V2)和V0=VT1T1/KT計算出KT和V0 的值,并存儲在單片機的EEPROM數(shù)據(jù)存儲器中,既完成該儀表的溫度測量精度的校正。初始化對單片機的工作非常重要,因為單片機經(jīng)過復(fù)位以后一些狀態(tài)字,寄存器的初值可能是隨機分配的值也可能是全置0或置1,程序在運行過程中,程序狀態(tài)字起著重要的作用,為了不影響程序的正常運行初始化是十分必要的。2口通過電阻、三極管與數(shù)碼管的共陽極連接。通過AD590的參數(shù)可以看出,它完全適合本設(shè)計的需要,同時AD590性能穩(wěn)定,即便經(jīng)過很長一段時間它的漂移量也很小,而且工作電路簡單直觀。工作電壓: – (5V 單片機)、具有通用I/O 口(27/23 個),復(fù)位后為: 準(zhǔn)雙向口/ 弱上拉(普通8051 傳統(tǒng)I/O 口) 分別可設(shè)置成四種模式:準(zhǔn)雙向口/ 弱上拉,推挽/ 強上拉,僅為輸入/ 高阻,開漏,同時每個I/O 口驅(qū)動能力均可達到20mA,但整個芯片最大不得超過55mA;STC12C5410AD 單片機I S P (在系統(tǒng)可編程)/ I A P (在應(yīng)用可編程),無需專用編程器,無需專用仿真器,可通過串口()直接下載用戶程序,數(shù)秒即可完成一片;時鐘源:外部高精度晶體/ 時鐘,內(nèi)部R/C 振蕩器,用戶在下載用戶程序時,可選擇是使用內(nèi)部R/C 振蕩器還是外部晶體/ 時鐘,常溫下內(nèi)部R/C 振蕩器頻率為: ~ ,精度要求不高時,可選擇使用內(nèi)部時鐘,但因為有制造誤差和溫漂,應(yīng)認為是4MHz ~ 8MHz。電阻的電壓輸入到STC12C5410AD單片機中,經(jīng)ADC轉(zhuǎn)換為數(shù)字量,有應(yīng)用軟件處理得到環(huán)境溫度。論文的第一章介紹了溫濕度檢測儀的主要性能指標(biāo)及其工作原理,主要介紹了溫濕度檢測儀的硬件設(shè)計總體方案和溫濕度檢測儀的應(yīng)用軟件系統(tǒng)的總體設(shè)計方案;第二章主要介紹了溫濕度檢測儀的硬件電路設(shè)計,重點介紹了溫度檢測電路、鍵盤LED顯示電路和濕度檢測電路;第三章主要介紹了基于STC12C5410AD單片機的濕度檢測儀的軟件設(shè)計,軟件設(shè)計部分采用模塊化設(shè)計,重點介紹了濕度檢測模塊程序設(shè)計中鍵盤掃描、LED顯示以及對濕度的頻率的線性化處理和溫度補償。 溫濕度檢測儀的硬件電路設(shè)計 7167?;诖藛纹瑱C的溫濕度檢測儀可以實時、準(zhǔn)確的測量環(huán)境中的溫度和相對濕度。 溫濕度檢測模塊程序設(shè)計 12167。該設(shè)計主要分為硬件設(shè)計和軟件部分的設(shè)計,下面先總體介紹設(shè)計的性能指標(biāo)和軟硬件的總體設(shè)計方案。 溫濕度檢測儀應(yīng)用軟件系統(tǒng)的設(shè)計方案該儀表的系統(tǒng)程序設(shè)計采用模塊化的程序設(shè)計方法,其結(jié)構(gòu)見圖12:圖12 軟件設(shè)計模塊圖檢測儀的應(yīng)用軟件系統(tǒng)包括:主程序模塊、溫度檢測模塊、相對濕度檢測模塊、鍵盤和顯示模塊等。隨著電容的充電,RST腳上的電壓才慢慢下降。濕度檢測電路通過濕度傳感器THS11采集環(huán)境中的相對濕度。從LED 顯示器的顯示原理可知,為了顯示字母數(shù)字,必須最終轉(zhuǎn)換成相應(yīng)段選碼。t為絕對溫度,單位為K。模擬/ 數(shù)字轉(zhuǎn)換結(jié)果計算公式如下:結(jié)果 ( ADC_DATA[7:0],ADC_LOW2[1:0] ) = 1024 x Vin / VccVin 為模擬輸入通道輸入電壓,Vcc 為單片機實際工作電壓,用單片機工作電壓作為模擬參考電壓。 濕度檢測模塊程序設(shè)計1. 程序欲解決問題分析濕度測量電路是由濕度傳感器THS11和NE555構(gòu)成的振蕩電路組成。同時,相對濕度受環(huán)境溫度的影響比較大。程序首先從存儲器中讀取溫度補償過的頻率f,把它賦給一個事先定義好的變量。本設(shè)計的鍵盤就在此基礎(chǔ)上設(shè)計的,同時也為了節(jié)約單片機的硬件資源,具體流程如下:圖37 鍵盤掃描子程序流程圖該檢測儀采用18矩陣式鍵盤,關(guān)于它的具體硬件組成電路這里就不多做介紹,在檢測有無鍵按下方面主要用的是開機自動掃描方式,該方式是利用單片機運行程序初始化后自動掃描鍵盤,如果沒有鍵按下則繼續(xù)掃描,若有鍵按下即可出對應(yīng)的鍵值,再由鍵值跳轉(zhuǎn)到相應(yīng)的子程序,從而實現(xiàn)鍵盤掃描,鍵盤掃描子程序流程圖如圖37所示。本設(shè)計沒有BCD碼譯碼器,必須通過軟件查表把要顯示的數(shù)據(jù)轉(zhuǎn)變成BCD碼,對于有小數(shù)點和無小數(shù)點的,本設(shè)計就得寫兩個不同的表用來查詢。:北京航空航天出版社,2002[13] :高等教育出版社,2002[14] 劉書明、[M] .西安:西安電子科技大學(xué)出版社,2000.[15] 涂玲英.肖俊武.張宇.智能型溫濕度測控儀研究與實踐.湖北工學(xué)院學(xué)報.2002.[16] 蔡美琴.MCS一51系列單片機系統(tǒng)及其應(yīng)用.高等教育出社.1992.附 錄 溫度、相對濕度檢測儀的電路原理圖外文資料原文DS1820FEATURES? Unique 1–WireTM interface requires only one port pinfor munication? Multidrop capability simplifies distributed temperaturesensing applications? Requires no external ponents? Can be powered from data line? Zero standby power required? Measures temperatures from –55176。C LSB, yielding the following 9–bit format:The most significant (sign) bit is duplicated into all of the bits in the upper MSB of the two–byte temperature register in memory. This “sign–extension” yields the 16–bit temperature readings as shown in Table 1. Higher resolutions may be obtained by the following procedure. First, read the temperature, and truncate the 176。F increments? Temperature is read as a 9–bit digital value.? Converts temperature to digital word in 200 ms (typ.)? User–definable, nonvolatile temperature alarm settings? Alarm search mand identifies and addressesdevices whose temperature is outside of programmedlimits (temperature alarm condition)? Applications include thermostatic controls, industrialsystems, consumer products, thermometers, or anythermally sensitive systemDESCRIPTIONThe DS1820 Digital Thermometer provides 9–bit temperature readings which indicate the temperature of the device. Information is sent to/from the DS1820 over a 1–Wire interface, so that only one wire (and ground) needs to be connected from a central microprocessor to a DS1820. Power for reading, writing, and performing temperature conversions can be derived from the data line itself with no need for an external power source. Because each DS1820 contains a unique silicon serial number, multiple DS1820s can exist on the same 1–Wire bus. This allows for placing temperature sensors in many different where this feature is useful include HVAC environmental controls, sensing temperatures inside buildings, equipment or machinery, and in process monitoring and control.DETAILED PIN DESCRIPTIONOVERVIEWThe block diagram of Figure 1 shows the major ponentsof the DS1820. The DS1820 has three main data ponents: 1) 64–bit lasered ROM, 2) temperature and sensor, 3) nonvolatile temperature alarm triggers TH and TL. The device derives its power from the 1–Wire munication line by storing energy on an internal capacitor during periods of time when the signal line is high and continues to operate off this power source during the low times of the 1–Wire line until it returns high to replenish the parasite (capacitor) supply. As an alternative, the DS1820 may also be powered from an external 5 volts supply. Communication to