The DS18B20 Digital Thermometer provide 9-12bit temperature readings which
indicate the temperature of the device.
Information is sent to or from the DS18B20 over a one-Wire interface, so that only one wire needs to be connected from a central microprocessor to a DS18B20. 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 DS18B20 contains a unique silicon serial number, multiple DS18B20s can exist on the same one-Wire bus. This allows for placing temperature sensors in many different places. Applications where this feature is useful include HVAC environmental controls, sensing temperatures inside buildings,equipment or machinery, and process monitoring and control.
Pin Assignment and Configurations
DS18B20 chip can work in "parasite" power mode, the model allows the DS18B20 in the absence of external power status when bus is high at ordinary times, parasitic power by a single bus via the VDD pin, when the DS18B20 can steal energy from the bus, and the" stolen "can store to parasite power storage can capacitor (CPP), when the bus is low usually release energy supply device use. So, when the DS18B20 is working in a parasitic mode, the VDD pin must be grounded.
variety of circuit mode
DS18B20 provide a variety of circuit connection mode,its external power supply mode is single and multiple power supply like below photo shown.
DS18B20 chip by the one-wire bus protocol on a single communication port, when all devices via a three state port or drain open drain port connected with the bus, the line of control need to connect a weak pullup resistor. When connecting a plurality of DS18B20, each DS18B20 have a globally unique 64 bit serial number, in the bus system, microprocessors rely on each device unique 64 bit serial number identification on the bus on the bus device and recording device address, which allows multiple DS18B20 are simultaneously connected to a single bus, therefore, can easily use a microprocessor to control a lot of distribution in different regions of DS18B20 and the characteristics in the environment control, detection of building, equipment, such as temperature and process monitoring and control.
In addition to the above traditional external power supply circuit connection diagram, the DS18B20 can also work in "parasite" power mode. The following picture point the DS18B20 in "parasite" power mode circuit connection diagram. this will enable the DS18B20 to work in a parasitic mode, without additional power can be collected in real time in a number of locations of the temperature information.
DS18B20 internal register analysis and working principle,
The results of the main internal registers in DS18B20
Working flow of the main register of DS18B20
DS18B20 communication diagram
DS18B20 will start enter a low power with wait state, when required to perform temperature measurement and AD conversion, bus controller (SCM) send comand [44H] temperature measurement and AD conversion (see table instruction above other function instruction), DS18B20 temperature data is stored as a two byte to the scratchpad registers of the temperature and DS18B20 to maintain a wait state. When the DS18B20 chip by an external power supply, controller bus after the temperature conversion instruction initiated "read time slots" ,so as to read the temperature data measured by bus and SCM data communications (DS18B20 temperature conversion is in progress by the DQ pin returns 0, conversion is complete, return 1. If the DS18B20 is powered by a parasitic power supply, the bus will not have a return value unless the bus is pulled by a high on the temperature conversion. In addition, DS18B20 in the completion of a temperature conversion, the temperature value will be stored in TH (high temperature trigger) and TL (low alarm trigger) in the preset one byte of user defined value, S mark bit in a register (see chart in the register format "TH and TL register format" the temperature value (positive and negative) pointed out that S=0 is positive, S=1 is negative), if the measured temperature is higher than TH or lower than the TL, the alarm condition is established, DS18B20 will internal to an alarm mark position, at this time, the bus controller sends out searching command [ECH] detection on the bus all DS18B20 alarm then, the identification mark, alarm set DS18B20 will respond to search command.
According to DS18B20 TH (high temperature trigger register) and TL (low trigger register), if you use TH and TL to register in a temperature measurement system, don't feel unable to start, see "DS18B20 register structure", the read operation controller will begin to gradually down to read data from the 0, until the 8, and other registers TH and TL registers the internal structure and the data format and the chip is the same, of course, for the TH and TL registers to read and write and other registers in the chip to read and write is the same, so in practical application, when the DS18B20 is initialized, first by bus controller from [B8H] the instruction EEPROM data stored in the register back to TH and TL, "read time slots" and then through the bus controller to send the device register read operation, as long as read Each of the 8-bit data timely access, can be easily by bus controller read th and TL register data; bus controller of the device write operation principle of vice versa, in other words, as long as the master of the other registers that are programmed to operate, it is entirely possible is easy to th and TL the two alarm value register read and write operations. At the same time, you can copy the TH and TL register data to the EEPROM through the [48H] instruction.
In the constructed by chip DS18B20 temperature detection system, the single bus data communication way, in a bus mounted multiple DS18B20 allows, in the operation and control of DS18B20, issued by the bus controller slot signal is particularly important. DS18B20 chip power on initialization time slot, bus controller from the DS18B20 read data slots, bus controller writes data to the DS18B20 slot, in system programming, be sure to strictly refer to data of time slot graph of data document, do accurate grasp of bus level changes with time (microsecond), will be able to successfully control and operations DS18B20. In addition, we need to note that the machine cycle is not the same, so the delay function of the program is not exactly the same, according to the different machine cycle. In the usual DS18B20 program debugging, if found, such as temperature display errors and other failures, are basically due to large errors in time slot and slot errors caused, in the DS18B20 programming need to pay more attention to that.