Electronic Design

Two-Chip Digital Thermometer Delivers 0.4°C Accuracy

An LED digital thermometer with an operating range between 0°C and 150°C, 1°C resolution, and ±0.4°C accuracy is presented in the figure. This design is based on the PIC16F872 microcontroller. Because a software routine handles all tasks, an external ADC and decoders aren't required. A National Semiconductor LM35 temperature sensor gives the circuit a high linearity and low percentage error of the sensed temperature.

Output from the LM35 is connected to an LM6134 op amp, which is configured as a noninverting amplifier with a gain of 2. This gain serves to adjust the sensor's resolution (V/°C) to the microcontroller's ADC. Because only 8 bits of the ADC are used, the resolution is 20 mV.

The ADC's reference voltages, V+ and V-, are VDD and ground, respectively. Software in the microcontroller performs several functions, such as ADC operation, conversion from BCD to seven segments, overflow, and out-of-range detection. Register ADCON1 configures the reference voltages and the ADC's analog input.

Five typical temperature measurements are described in the table. Notice that the 8-bit reading from the ADC is converted to a BCD format that corresponds to the real sensed temperature. A software subroutine then converts the BCD reading to a seven-segment format to directly drive the LED display. Port RB drives the units digit, while Port RC drives the tens digit. The microcontroller's output lines, RC7 and RB7, control the hundreds digit.

The following description is based on the software listing, found at www.elecdesign.com:

The temperature reading from the microcontroller's ADC goes to the register, ADRESH. A subroutine called OP_TAB translates this result to BCD, then adds it to the program counter, PCL. This creates an unconditional jump to get the BCD value using the RETLW-type instruction, which contains the two BCD digits of the measured temperature. Next, the BCD reading is converted to a seven-segment format by calling the subroutine OP_TAB2. Subroutine OP_TAB3 controls the hundreds digit.

To download the listings, click Download the Code.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish