Datasheet DS18B20 - 9

DescriptionProgrammable Resolution1-Wire Digital Thermometer
Pages / Page20 / 9 — Configuration Register. CRC Generation. BIT 7. BIT 6. BIT 5. BIT 4. BIT …
File Format / SizePDF / 496 Kb
Document LanguageEnglish

Configuration Register. CRC Generation. BIT 7. BIT 6. BIT 5. BIT 4. BIT 3. BIT 2. BIT 1. BIT 0

Configuration Register CRC Generation BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0

Model Line for this Datasheet

Text Version of Document

link to page 9 link to page 9 link to page 9 link to page 9 DS18B20 Programmable Resolution 1-Wire Digital Thermometer
Configuration Register
received error free. The comparison of CRC values and Byte 4 of the scratchpad memory contains the configura- the decision to continue with an operation are determined tion register, which is organized as illustrated in Figure 10. entirely by the bus master. There is no circuitry inside the The user can set the conversion resolution of the DS18B20 DS18B20 that prevents a command sequence from pro- using the R0 and R1 bits in this register as shown in Table ceeding if the DS18B20 CRC (ROM or scratchpad) does 2. The power-up default of these bits is R0 = 1 and R1 = not match the value generated by the bus master. 1 (12-bit resolution). Note that there is a direct tradeoff The equivalent polynomial function of the CRC (ROM or between resolution and conversion time. Bit 7 and bits 0 to scratchpad) is: 4 in the configuration register are reserved for internal use CRC = X8 + X5 + X4 + 1 by the device and cannot be overwritten. The bus master can re-calculate the CRC and compare it
CRC Generation
to the CRC values from the DS18B20 using the polyno- mial generator shown in Figure 11. This circuit consists CRC bytes are provided as part of the DS18B20’s 64-bit of a shift register and XOR gates, and the shift register ROM code and in the 9th byte of the scratchpad memory. bits are initialized to 0. Starting with the least significant The ROM code CRC is calculated from the first 56 bits bit of the ROM code or the least significant bit of byte 0 of the ROM code and is contained in the most significant in the scratchpad, one bit at a time should shifted into the byte of the ROM. The scratchpad CRC is calculated from shift register. After shifting in the 56th bit from the ROM or the data stored in the scratchpad, and therefore it chang- the most significant bit of byte 7 from the scratchpad, the es when the data in the scratchpad changes. The CRCs polynomial generator will contain the recalculated CRC. provide the bus master with a method of data validation Next, the 8-bit ROM code or scratchpad CRC from the when data is read from the DS18B20. To verify that data DS18B20 must be shifted into the circuit. At this point, if has been read correctly, the bus master must re-calculate the re-calculated CRC was correct, the shift register will the CRC from the received data and then compare this contain all 0s. Additional information about the Maxim value to either the ROM code CRC (for ROM reads) or 1-Wire cyclic redundancy check is available in Application to the scratchpad CRC (for scratchpad reads). If the cal- Note 27: Understanding and Using Cyclic Redundancy culated CRC matches the read CRC, the data has been Checks with Maxim iButton Products.
BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0
0 R1 R0 1 1 1 1 1 Figure 10. Configuration Register
Table 2. Thermometer Resolution Configuration R1 R0 RESOLUTION (BITS) MAX CONVERSION TIME
0 0 9 93.75ms (tCONV/8) 0 1 10 187.5ms (tCONV/4) 1 0 11 375ms (tCONV/2) 1 1 12 750ms (tCONV) INPUT XOR XOR XOR MSB LSB Figure 11. CRC Generator www.maximintegrated.com Maxim Integrated │ 9