【正文】
s system, the microprocessor (the master device) identifies and addresses devices on the bus using each device’s unique 64bit code. Because each device has a unique code, the number of devices that can be addressed on one bus is virtually unlimited Another feature of the DS18B20 is the ability to operate without an external power supply. Power is instead supplied through the 1Wire pull up resistor via the DQ pin when the bus is high. The high bus signal also charges an internal capacitor (C ), which then supplies power to the device when the bus is PP low. This method of deriving power from the 1Wire bus is referred to as ―parasite power.‖ As an alternative, the DS18B20 may also be powered by an external supply on VDD OPERATION — MEASURING TEMPERATURE The core functionality of the DS18B20 is its directtodigital temperature sensor. The resolution of the temperature sensor is userconfigurable to 9, 10, 11, or 12 bits, corresponding to increments of C, C, C, and C, respectively. The default resolution at powerup is 12bit. The DS18B20 powersup in a lowpower idle state。它可以檢測(cè)的范圍是 55176。 C。這樣很容易就可以實(shí)現(xiàn)一個(gè)單片機(jī)控制多個(gè)溫度傳感器。此外,暫時(shí)寄存器還和一個(gè)字節(jié)的上限、下限寄存器相連,同時(shí)也和一個(gè)字節(jié)的配置字相連。數(shù)據(jù)線也就是總線需要一個(gè)比較小的上拉電阻,因?yàn)樗械男盘?hào)都是通過總線來傳輸?shù)?,這根總線有三種狀態(tài),在單總線系統(tǒng)中,單片機(jī)也就是主設(shè)備通過溫度傳感器的唯一的 64 位碼來識(shí)別和定位傳感器。而當(dāng) DQ為低電平時(shí),傳 感器就不工作了?當(dāng)然不是了,在溫度傳感器的內(nèi)部有一個(gè)電容,當(dāng) DQ 為高電平時(shí)充電,當(dāng) DQ 為低電平時(shí)放電,放出來的電給傳感器供電。默認(rèn)情況下是設(shè)置成 12 位模式的。如果 DS18B20 是寄生供電的話,由于在傳感器轉(zhuǎn)換期間需要比較大量的電能,所以就不能夠支持上訴的功能了。如果是 11 位精度的話,第一位沒有定義。溫度傳感器的寄生電源是在 DQ管腳為高電壓的時(shí)候存儲(chǔ)電量來為以后 DQ 為低的時(shí)候供電。為了確保 DS18B20 能夠有足夠的電流來實(shí)現(xiàn)溫度轉(zhuǎn)化功能和數(shù)據(jù)拷貝功能,所以不論在這兩個(gè)功能中那一個(gè)即將進(jìn)行之前都應(yīng)該給溫度傳感器一個(gè)很強(qiáng)的高電壓