【文章內(nèi)容簡介】
egister that stores the digital output from the temperature sensor. In addition, the scratchpad provides access to the 1byte upper and lower alarm trigger registers (TH and TL) and the 1byteconfiguration register. The configuration register allows the user to set the resolution of the temperaturetodigital conversion to 9, 10, 11, or 12 bits. The TH, TL, and configuration registers are nonvolatile (EEPROM), so they will retain data when the device is powered down.The DS18B20 uses Maxim’s exclusive 1Wire bus protocol that implements bus munication using one control signal. The control line requires a weak pullup resistor since all devices are linked to the bus via a 3state or opendrain port (the DQ pin in the case of the DS18B20). In this bus system, the microprocessor (the master device) identifies and addresses devices on the bus using each device’s unique64bit code. Because each device has a unique code, the number of devices that can be addressed on one bus is virtually unlimited. The 1Wire bus protocol, including detailed explanations of the mands and “time slots,” is covered in the 1Wire Bus System section.Another feature of the DS18B20 is the ability to operate without an external power supply. Power is instead supplied through the 1Wire pullup resistor via the DQ pin when the bus is high. The high bus signal also charges an internal capacitor (CPP), which then supplies power to the device when the bus is 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.Figure 1. DS18B20 Block DiagramOPERATION—MEASURING TEMPERATUREThe 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 176。C, 176。C, 176。C, and 176。C, respectively. The default resolution at powerup is 12bit. The DS18B20 powers up in a lowpower idle state. 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 transmitting0 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 pullup during the entire temperature conversion. The bus requirements for parasite power are explained in detail in the Powering the DS18B20 section.Figure 2. Temperature Register FormatTable 1. Temperature/Data Relationship*The poweron reset value of the temperature register is +85176。C.OPERATION—ALARM SIGNALINGAfter the DS18B20 performs a temperature conversion, the temperature value is pared to the userdefined two’s plement alarm trigger values stored in the 1byte TH and TL registers (see Figure 3). The sign bit (S) indicates if the value is positive or negative: for positive numbers S = 0 and for negative numbers S = 1. The TH and TL registers are nonvolatile (EEPROM) so they will retain data when the device is powered down. TH and TL can be accessed through bytes 2 and 3 of the scratchpad as explained in the Memory section.Figure 3. TH and TL Register FormatOnly bits 11 through 4 of the temperature register are used in the TH and TL parison since TH and TL are 8bit registers. If the measured temperature is lower than or equal to TL or higher than or equal to TH, an alarm condition exists and an alarm flag is set inside the DS18B20. This flag is updated after every temperature measurement。 therefore, if the alarm condition goes away, the flag will be turned off after the next temperature conversion.The master device can check the alarm flag status of all DS18B20s on the bus by issuing an Alarm Search [ECh] mand. Any DS18B20s with a set alarm flag will respond to the mand, so the master can determine exactly which DS18B20s have experienced an alarm condition. If an alarm condition exists and the TH or TL settings have changed, another temperature conversion should be done to validate the alarm condition.POWERING THE DS18B20The DS18B20 can be powered by an external supply on the VDD pin, or it can operate in “parasite power” mode, which allows the DS18B20 to function without a local external supply. Parasite power is very useful for applications that require remote temperature sensing or that are very space constrained. Figure 1 shows the DS18B20’s parasitepower control circuitry, which “steals” power from the 1Wirebus via the DQ pin when the bus is high. The stolen charge powers the DS18B20 while the bus is high, and some of the charge is stored on the parasite power capacitor (CPP) to provide power when the bus is low. When the DS18B20 is used in parasite power mode, the VDD pin must be connected to ground.In parasite power mode, the 1Wire bus and CPP can provide sufficient current to the DS18B20 for most operations as long as the specified timing and voltage requirements are met (see the DC Electrical Characteristics and AC Electrical Characteristics). However, when the DS18B20 is performing temperature conversions or copying data from the scratchpad memory to EEPROM, the operating current can be as high as . This current can cause an unacceptable voltage drop across the weak 1Wire pullup resistor and is more current than can be supplied by CPP. To assure that the DS18B20 has sufficient supply current, it is necessary to provide a strong pullup on the 1Wire bus whenever temperature conversions are taking place or data is being copied from the scratchpad to EEPROM. This can beacplished by us