Increasing Temperature Resolution on the DS1620
IntroductionThe DS1620 Digital Thermometer and Thermostat provides 9 bit temperature readings which indicate the temperature of the device. This temperature is expressed in 0.5°C increments, providing 0.5°C resolution. In the 0°C to +70°C range, the part is accurate to 0.5°C as well. In the -40°C to 0°C range, as well as from +70°C to +85°C, the DS1620s accuracy is within 1°C. Extending the temperature range even further, from -55°C to -40°C and from +85°C to +125°C, the device is accurate to within 2°C.
These accuracies are very good as far as temperature sensors go, but there are situations where the 0.5°C resolution is not adequate. In proportional control systems where the absolute temperature is not as critical as the trend in temperature, greater resolution may be required.
Using some undocumented test modes for the DS1620 allows the user to provide 0.1°C resolution with the DS1620 and some overhead software. While this does not increase the accuracy of the device, it may provide better control of some systems by having finer resolution of temperature.
Operation Measuring TemperatureThe DS1620 measures temperatures through the use of an on-board proprietary temperature measurement technique. A block diagram of the temperature measurement circuitry is shown in Figure 1.
The DS1620 measures temperature by counting the number of clock cycles that an oscillator with a low temperature coefficient goes through during a gate period determined by a high temperature coefficient oscillator. The counter is preset with a base count that corresponds to -55°C. If the counter reaches zero before the gate period is over, the temperature register, which is also preset to the -55°C value, is incremented, indicating that the temperature is higher than -55°C.
At the same time, the counter is then preset with a value determined by the slope accumulator circuitry. This circuitry is needed to compensate for the parabolic behavior of the oscillators over temperature. The counter is then clocked again until it reaches zero. If the gate period is still not finished, then this process repeats.
The slope accumulator is used to compensate for the nonlinear behavior of the oscillators over temperature, yielding a high resolution temperature measurement. This is done by changing the number of counts necessary for the counter to go through for each incremental degree in temperature. To obtain the desired resolution, therefore, both the value of the counter and the number of counts per degree C (the value of the slope accumulator) at a given temperature must be known.
Internally, this calculation is done inside the DS1620 to provide 0.5°C resolution. Note that temperature is represented in the DS1620 in terms of a 1/2°C LSB, yielding the following 9-bit format:
Higher resolutions may be obtained by reading the temperature and truncating the 0.5°C bit (the LSB) from the read value. This value is TEMP_READ. The value left in the counter may then be read. This value is the count remaining (COUNT_REMAIN) after the gate period has ceased. By loading the value of the slope accumulator into the count register, this value may then be read, yielding the number of counts per degree C (COUNT_PER_C) at that temperature. The actual temperature may be then be calculated by the user using the following:
Figure 1. Temperature Measuring Circuitry
Obtaining 0.1°C Resolution with the DS1620
- The following steps describe the process necessary to obtain 0.1°C resolution from the DS1620. If the DS1620 is not already in ONESHOT mode, do so by sending the WRITE CONFIG protocol with the appropriate write data. For more information on this protocol and the mode settings, see the DS1620 data sheet.
Protocol to set both ONESHOT and CPU modes:
0C 03 (hex)
Protocol to set only ONESHOT mode:
0C 01 (hex)
The first protocol listed above is usually the desired mode setting when using a computer to control the DS1620.
- Issue the START CONVERT command to the part (EE hex).
- Issue the READ CONFIG command (AC hex) to read the configuration register data from the DS1620. Repeat this command until the most significant bit (i.e., the DONE bit) of the register is a '1'. This means that the temperature conversion has completed. The logical description for that condition using C language nomenclature is:
(config & 0x80) = = 0x80
- Issue the READ TEMPERATURE command, as described in the data sheet, which is AA hex. Truncate the 1/2 degree bit from the read value, and convert it to a signed integer. That modified value is TEMP_READ.
- Issue the READ COUNTER command, which is not documented in the data sheet. That protocol works the same way as those that read the thermostat set-tings. First, send the protocol, which is A0 hex. Then read back a 9-bit value from the part. This value is COUNT_REMAIN.
- Issue the LOAD SLOPE command, which also is not documented in the data sheet. The protocol is 41 hex, and requires no data to read or write. This command loads the slope value into the counter.
- Issue the READ COUNTER command again, as described in step 5 above. The value read is COUNT_PER_C.
- Calculate the actual temperature using the following formula, again using C nomenclature:
TEMPERATURE=TEMP_READ - 0.25
+ (COUNT_PER_C - COUNT_REMAIN) /
- Repeat steps 2 through 8 as desired.
See Application Note 105 for sample C code. The code can be downloaded from Dallas Semiconductor's anonymous FTP site.