【正文】
me 1–wire bus。C 到 +85176。 RAM 中存儲(chǔ)著兩個(gè)字節(jié)的溫度值,這兩個(gè)字節(jié)的數(shù)據(jù)將來(lái)要通過(guò)數(shù)據(jù)總線傳到單片機(jī)那里。電源是通過(guò)單總線系統(tǒng)中的 DQ 管腳傳入的,當(dāng)這個(gè)管腳是高電壓時(shí)供電。如果DS18B20 是由額外電源供電的話,那么 DS18B20 會(huì)在正在轉(zhuǎn)換時(shí)保持低電平,而完成轉(zhuǎn)換之后就會(huì)保持高電平了。寄生電源對(duì)于要求要求遠(yuǎn)距離溫度檢測(cè)的應(yīng)用或者是那些非常惡劣的環(huán)境下的一個(gè)用來(lái)說(shuō)是非常合適的。而且當(dāng)傳感器工作在寄生電源的模式下時(shí), VDD 管腳一定要接地,不然就會(huì)不能判定究竟是在什么模式在工作了。溫度傳感器中要輸出的溫度數(shù)據(jù)單位是按照攝氏溫度來(lái)的,如果要轉(zhuǎn)換成華氏溫度的話就需要用戶自己做一個(gè)轉(zhuǎn)換表了。當(dāng)然如果不只使用溫度傳感器的一個(gè)管腳的話,也可以由額外供電,也就是通過(guò)傳感器的 VDD 管腳,給它提供 +5V的電壓就可以使 DS18B20 正常工作了。這個(gè)配置寄存器允許用戶設(shè)置溫度傳感器的分辨率在 1 12 這四個(gè)數(shù)之間。此外 DS18B20 能夠通過(guò)數(shù)據(jù)線驅(qū)動(dòng),也就是通過(guò)數(shù)據(jù)線傳遞能量,這樣就可以避免另外設(shè)計(jì)電源電路和電源線了。 to initiate a temperature measurement and AtoD conversion, the master must issue a Convert T [44h] mand. Following the conversion, the resulting thermal data is stored in the 2byte temperature register in the scratchpad memory and the DS18B20 returns to its idle state. If the DS18B20 is powered by an external supply, the master can issue ―read time slots‖ (see the 1WIRE BUS SYSTEM section) after the Convert T mand and the DS18B20 will respond by transmitting 0 while the temperature conversion is in progress and 1 when the conversion is done. If the DS18B20 is powered with parasite power, this notification technique cannot be used since the bus must be pulled high by a strong pull up during the entire temperature conversion. The DS18B20 output temperature data is calibrated in degrees centigrade。C to +125176。它可以檢測(cè)的范圍是 55176。這樣很容易就可以實(shí)現(xiàn)一個(gè)單片機(jī)控制多個(gè)溫度傳感器。數(shù)據(jù)線也就是總線需要一個(gè)比較小的上拉電阻,因?yàn)樗械男盘?hào)都是通過(guò)總線來(lái)傳輸?shù)模@根總線有三種狀態(tài),在單總線系統(tǒng)中,單片機(jī)也就是主設(shè)備通過(guò)溫度傳感器的唯一的 64 位碼來(lái)識(shí)別和定位傳感器。默認(rèn)情況下是設(shè)置成 12 位模式的。如果是 11 位精度的話,第一位沒(méi)有定義。為了確保 DS18B20 能夠有足夠的電流來(lái)實(shí)現(xiàn)溫度轉(zhuǎn)化功能和數(shù)據(jù)拷貝功能,所以不論在這兩個(gè)功能中那一個(gè)即將進(jìn)行之前都應(yīng)該給溫度傳感器一個(gè)很強(qiáng)的高電壓