China sensor manufacturers

China Temperature Sensor & Thermistor manufacturer

Microcontroller Programming of DS18B20 Sensor

For the programming of the DS18B20 chip sensor, it can be understood that the bus controller operates the device or the corresponding register in the device through relevant instructions, thereby completing the data communication between the device and the bus controller. Therefore, to truly master the communication programming of DS18B20, you need to have a detailed understanding of the various register structures, register data formats and related instruction systems of the chip. Next, we will talk about the internal memory structure of DS18B20 based on the above diagram.

Each temporary register of DS18B20 has 8bit storage space to store corresponding data. Among them, byte0 and byte1 are the low and high bits of the temperature data respectively, which are used to store the measured temperature value, and these two bytes are read-only. Byte2 and byte3 are copies of the TH and TL alarm trigger values. It can be read from the on-chip electrically erasable programmable read-only memory EEPROM, or the values of TH and TL in the temporary register can be written to the EEPROM through the [48H] instruction issued by the bus controller. The data in EEPROM will not be lost after power failure. The byte4 configuration register is used to configure the accuracy of temperature conversion (maximum 12-bit accuracy). Bytes 5, 6, and 7 are reserved bits and writing is prohibited. byte8 is also a read-only memory used to store the above 8-byte CRC check code.

Refer to the DS18B20 communication instruction diagram above, which is the data format and necessary individual identification bit descriptions of the main registers in the DS18B20 chip. As long as the register data is accurately controlled, the programming of DS18B20 can be easily completed. As for the control instructions issued by the bus controller, we need to know that the instructions of DS18B20 include ROM instructions and function instructions. Among them, ROM instructions are used to operate ROM, while functional instructions can control DS18B20 to complete functional tasks such as temperature conversion and register operations. Once the bus controller detects a presence pulse, it issues a ROM command. If multiple DS18B20s are mounted on the bus, these instructions will use the device's unique 64-bit ROM chip serial code to select the specific device to be operated. Likewise, these instructions can identify which devices meet alarm conditions, etc. After the bus controller sends a ROM instruction to the DS18B20 to be connected, it can send a function instruction to complete the relevant work. In other words, the bus controller needs to first issue a ROM command before initiating a DS18B20 function command. After understanding the functions and usage of these functional instructions, it will be much easier to program the DS18B20! ~
DS18B20 temperature sensor module
PREV:What is the Temperature Measurement Chip DS18B20?
NEXT:Experience using DS18B20 Chip Digital Sensor

RELATED POSTS




Skype

WhatsApp

WangWang

QQ
Email me

Mail to us