【正文】
bus interface circuit 4) Pc. The system frame as shown in figure1. Using CS051F060 MCU mouth to virtual DATA, using OAT A mouth to virtual clock lines, thus directly with SHT75 digital temperature and humidity sensors connected and carries on the control, after power up SHT75 after 10ms time came into sleep mode, before this should not transmit any orders. When make OAT A line at a high levels, triggering SCK nine times above (contain nine times), and then send a transmission start mand to activate SHT75, chip is evocation. Then an measurement mand (measuring temperature mand for 00000011, measuring relative humidity orders for 00000101), I1C will start SCK until plete measurement. Will then enters drawn into a low level, I1C again restart SCI(, then transmit two measurement data bytes. I1C data must be drawn into a low level, ability for each byte produce response order from highest bits (MSB) to bytealigned (LSB). When sensor electricity reattachment, program will enter waiting outside instructions cycle [51. If accepted to let sensor39。s instructions, sensor, and measurement process will start of temperature or humidity realtime data acquisition and storage, waiting for PC take several orders.Because of the temperature and humidity of the SHT75 collected data must nonlinear pensation to get the actual environment temperature and humidity. To pensate for the nonlinear humidity sensors to gain accurate data, use the following type (1) correction output value: RH1 = C1 + C2 * SORH + C3S0RH2 (1)Among them: for RH1 pensated for SORH humidity value, SHT75 output of 8 bits or 12 bits humidity sensor value。 C 1, C2 and C2 value, as shown in table I and output humidity data about. MedianWhen measuring temperature with 25 C large difference, in order to pensate for temperature of humidity measurement impact, use type (2) correction output value:RHtrue = (T 25) (tl + t2 * SORH) + RH1 (2)Among them: for RHtrue RH1 pensation temperature influence after the humidity value, tl and t2 values as shown in chart 2, and output Humidity data digits are concernedIII. TEST AND ANAL YSIS OF THE RESULTSThe paper introduce debugging good system has been conducted, and separately carried on the static and dynamic tests, collected experimental data. From the microcontroller memory read out data shows, this system can acplish of temperature and humidity data acqUIsItIon, processing, and can be to monitor environment monitor in real time. Will microcontroller hardware system and regulate circuit and humidity sensor signal to the whole debugging,temperature and humidity data acquisition system have been tested . IV. CONCLUSIONThis paper is mainly used C8051 F060 singlechip microputer control SHT75 digital temperature and humidity sensors to collect storehouse room temperature, and humidity CAN bus pass data lose to PC monitor in real time. In data munications aspects, adopting CAN bus, so CAN effectively improve the measurement precision, temperature and humidity sensor is used a whole and digital output, so that the circuit is simple, high precision measurement. 基于單片機溫濕度數(shù)據(jù)采集系統(tǒng)設(shè)計摘要:在實際生產(chǎn)生活中,很多情況下我們都需要考慮溫度和濕度對環(huán)境的影響以及對其的精確控制,然后是數(shù)據(jù)采集系統(tǒng)的設(shè)計。由于CAN總線可以提高抗干擾能力、可靠性高、糾正能力強等,因此,使用CAN總線接口傳輸數(shù)據(jù)的上位機監(jiān)控。本文介紹了數(shù)據(jù)采集系統(tǒng)的設(shè)計,它是由溫濕度傳感器,單片機系統(tǒng),計算機, CAN總線構(gòu)成的。SHT75數(shù)字溫濕度傳感器采集的溫度和濕度的測量數(shù)據(jù)倉庫空間,通過總線interface,C8051F060單片機使用CAN總線接口與電腦進行實時的簡單快速的數(shù)據(jù)處理,并發(fā)送數(shù)據(jù)到C8051F060單片機系統(tǒng)監(jiān)控。經(jīng)過測試,該系統(tǒng)可實現(xiàn)數(shù)據(jù)采集,處理和通信。關(guān)鍵詞:溫濕度傳感器, C8051F060 ,數(shù)據(jù)采集,CAN總線一、引言由于集成電路制造技術(shù)的不斷提高,高性能、高可靠性的單片機DAS數(shù)據(jù)采集系統(tǒng)出現(xiàn)了。數(shù)據(jù)采集技術(shù)已經(jīng)成為一種專業(yè)的技術(shù),在工業(yè)領(lǐng)域得到了廣泛的應(yīng)用。數(shù)據(jù)采集系統(tǒng)采用更先進的模塊式結(jié)構(gòu),可根據(jù)不同的應(yīng)用需求,通過簡單的增加和改變模塊,并與系統(tǒng)編程相結(jié)合,可以擴大或修改系統(tǒng),迅速組成一個新的系統(tǒng)。溫濕度數(shù)據(jù)采集系統(tǒng)一直是有關(guān)科研單位和公司致力于的開發(fā)項目,其早期的系統(tǒng)在8031單片機核心采用熱敏電阻和濕敏電容作為溫度傳感器和濕度傳感器,整個系統(tǒng),雖然成本低,但體積大、精度低,通信距離的限制,通用性較差,為了克服上述的缺點上,本文研究了基于單片機的溫濕度數(shù)據(jù)采集系統(tǒng),實現(xiàn)對倉庫的溫濕度監(jiān)控,具有實時性好,精度高,操作簡單方便,信號收發(fā)器的維修方便的優(yōu)點。二、基于單片機溫濕度數(shù)據(jù)采集通過CS051F060單片機控制SHT75數(shù)字溫濕度傳感器來測量倉庫室內(nèi)溫度和濕度,并將通過總線接口cs051f060單片機系統(tǒng)發(fā)送數(shù)據(jù),單片機簡單快速的處理后通過CAN總線接口傳送給上位機監(jiān)控。A.CAN傳輸驅(qū)動模塊可通過單片機硬件CS051 F060傳輸驅(qū)動模塊 ,高速光TLP 113和隔離TJA I 050高速CAN收發(fā)器設(shè)備實現(xiàn)。其中, CS051F060實現(xiàn)CAN總線的應(yīng)用層功能, TJAI050實現(xiàn)CAN總線的物理層和數(shù)據(jù)鏈路層的功能。該模塊主要用于向上位機發(fā)送的溫度和濕度數(shù)據(jù),并接受控制指令。TJAI050 CAN總線發(fā)送功能提供差分,可以提供差分接收器的功能,并完全符合“ ISO l1S9S ”的標準,高速率,低電磁輻射,差分接收器的輸入范圍寬,可以對抗電磁干擾,沒有電總線節(jié)點不會造成干擾,自動發(fā)送數(shù)據(jù)( TXD )控制的附加功能,自動保護總線引腳, V設(shè)備兼容,以及電源和土地的過熱保護,以防止短路的作用。整個系統(tǒng)運行穩(wěn)定、可靠工作是在穩(wěn)定的電力供應(yīng)基礎(chǔ)上的,它是通過電源轉(zhuǎn)換芯片MAX165S和電氣隔離芯片B0505S設(shè)備組成的。 V,為CS051F060單片機和SHT75數(shù)字溫濕度傳感器提供電源。 5V電源通過將5V電源隔離成兩個部分,分別加在每一個光器件兩端。電源隔離芯片B0505S具有恒壓輸入,單輸出電壓隔離效率高的電源模塊,體積小,價格低,可靠性高,耐沖擊,隔離特性,溫度范圍寬等等。為了確保模塊的有效性和可靠性操作額定負荷,并輸出5% 100 %的負載,應(yīng)該避免在無負載條件下長期工作。溫濕度數(shù)據(jù)采集系統(tǒng)是由以下幾部分組成:1)溫濕度傳感器SHT75 。 2 ) CS051 F60的單片機; 3 ) CAN總線接口電路;4)在PC機的系統(tǒng)框架。圖1 系統(tǒng)框圖,從而直接與SHT75數(shù)字溫濕度傳感器連接,并進行控制。開機后10ms的時間SHT75進入睡眠模式,在此之前不應(yīng)發(fā)送任何命令。當 OAT A線是高電平時,觸發(fā)SCK9次以上(含9次) ,然后發(fā)送一個“傳輸啟動”命令來激活SHT75 ,芯片是招魂。然后,一個測量命令(測量溫度命令00000011 ,測量相對濕度命令00000101),I1C將啟動SCK,直到完成測量。然后當 OAT A線是低電平時,I1C再次重啟SCI,然后發(fā)送兩個測量數(shù)據(jù)字節(jié)。 I1C數(shù)據(jù)必須被置為一個低電平,這樣每個字節(jié)產(chǎn)生響應(yīng)信號的能力才能從最高位( MSB)到最低位(LSB)。當傳感器復位后,程序?qū)⑦M入指令周期。如果接受程序指示,傳感器和測量程序?qū)訙囟群蜐穸鹊膶崟r數(shù)據(jù)采集和存儲,等待電腦的幾個命令。因為SHT75采集的溫濕度數(shù)據(jù)必須非線性補償,以獲得實際的環(huán)境溫度和濕度。為了補償非線性濕度傳感器來獲得精確的數(shù)據(jù),使用下列類型式(1)來校正濕度輸出值: RH1= C1 + C2* SORH+ C3S0RH2 (1) 其中:RH1為SORH濕度值的補償,8位或12位濕度傳感器SHT75輸出 值。C 1,C 2和C 3的值,C3是C1和C2輸出濕度數(shù)據(jù)的中間數(shù)表1 濕度變換系數(shù)當測量溫度與25℃相差較大時,為了補償濕度測量的影響,利用式(2)校正溫度輸出值: RHtrue=(T25)(TL+ T2* SORH)+ RH1(2) 其中:RHtrue為RH1補償溫度影響的濕度值,T1和T2的值和輸出數(shù)據(jù)的數(shù)字濕度有關(guān),如表2所示:表2 溫度補償系統(tǒng)三、測試和結(jié)果本文已經(jīng)對系統(tǒng)進行了調(diào)試,并分別對靜態(tài)和動態(tài)電路進行測試,收集得到的實驗數(shù)據(jù)。從單片機的存儲器中讀出的數(shù)據(jù)圖表明,該系統(tǒng)可以實現(xiàn)溫濕度數(shù)據(jù)采集,處理,并可以實時監(jiān)測環(huán)境。圖2 接收數(shù)據(jù)接口將單片機的硬件系統(tǒng)和控制電路、溫濕度傳感器信號用于整體測試,然后確保溫濕度數(shù)據(jù)采集系統(tǒng)已完成檢測。圖3 溫濕度數(shù)據(jù)采集實驗數(shù)據(jù)收集。四、結(jié)論本文主要用于C8051 F060單片機控制SHT75數(shù)字式溫濕度傳感器采集倉庫室內(nèi)溫濕度,然后CAN總線將數(shù)據(jù)傳輸?shù)絇C機實時監(jiān)控。在數(shù)據(jù)通信方面,采用CAN總線,這樣可以有效地提高測量精度,溫度和濕度傳感器使用一個數(shù)字輸出,使電路簡單,測量精度高。附錄二:程序/*主程序*/includeincludeincludeincludeincludeunsigned char TempData[8]。void dis_time() //向12864寫時鐘數(shù)據(jù)//{ lcd_pos(0,1)。 write_date(TempData[1]/10+0x30)。 write_date(TempData[1]%10+0x30)。 lcd_pos(0,3)。 write_date(TempData[2]/10+0x30)。 write_date(TempData[2