English
Language : 

AN897 Datasheet, PDF (3/16 Pages) Microchip Technology – Thermistor Temperature Sensing with MCP6SX2 PGAs
0.0
-0.5
10-bit ADC
DC Error ≤ 3.5 LSb
-1.0
-1.5
Design # 1
-2.0 G = +1
RA = 10 kΩ
-2.5
-50 -25 0
25 50 75 100 125 150
Thermistor Temperature (°C)
FIGURE 6:
Resolution.
ADC’s Temperature
10
9
Design # 1
G = +1
8 RA = 10 k:
7
6
5
ADC Error
4
RA Error
3
PGA Error
2
1
0
-50 -25 0 25 50
75 100 125 150
Thermistor Temperature (°C)
FIGURE 7:
Analog Circuit Errors.
Digital Design
The PIC16F684 microcontroller (discussed in
Appendix A.2.5 “Signal Analysis PICtail Daughter
Board”) handles several important tasks. It communi-
cates with the PGA to set its input channel, can aver-
age the measured signal to reduce noise and converts
the result into the temperature at the thermistor using a
piece-wise linear interpolation table. The microcontrol-
ler can either have a SPI™ port built in or the SPI
interface can be implemented in software on the
microcontroller [7].
FLOWCHART
The flowchart in Figure 8 shows the program flow for
the first design. The firmware is available in
00897.zip file in the Design 1 directory. The firmware
was written in relocatable assembly code. main.asm
controls the overall program flow. The PGA routines
are in pga.inc and pga.asm. The thermistor routines
are located in Therm_PGA1.inc and
Therm_PGA1.asm.
The Signal Analysis PC Program commands the
PIC16F684 firmware to perform a real-time sample.
The firmware reads the ADC value and passes it to the
Piece-wise Linear Interpolation (PwLI) routine. The
PwLI routine converts the 10-bit ADC value into a 16-bit
 2004 Microchip Technology Inc.
AN897
fixed decimal point degrees Celsius value. The fixed
decimal point format reports degrees Celsius in tenths
of a degree. Performing the piece-wise linear interpola-
tion in tenths of a degree provides better resolution of
degrees Celsius. Finally, the 16-bit degrees Celsius
value is sent to the Signal Analysis PC Program for
display on the real-time strip chart graph.
In the final design, the designer can elect to report in
tenths of a degree or round up in whole degrees.
Start
Get Real Time Sample
Read ADC
Perform PwLI
Send Temperature in
°C to Strip Chart
End
FIGURE 8:
Flowchart for First Design.
PIECE-WISE LINEAR INTERPOLATION TABLE
A piece-wise linear interpolation table [9] is used to
convert ADC codes to estimated temperature. The
ADC’s codes were divided into 64 segments, with 16
codes per segment. The codes in the table are at end
points between segments. Table 1 shows the end
points chosen for this design.
TABLE 1:
INTERPOLATION TABLE END
POINTS.
Gain
(V/V)
ADC Code
(LSb)
TTH
RTH VOUT
(°C) (Ω)
(V)
1
1008
-49.4 630 k 4.922
16
156.1 159 0.078
Values given for RTH, when the temperature is outside
the thermistor’s specified range (-40°C to +150°C), are
estimates only; they are not supported by actual data.
The thermistor self-heating error correction has been
included in Table 1.
The table’s entries go outside of the -40°C to +150°C
range to ensure proper functioning of the piece-wise
linear interpolation table when the reading overflows. In
this algorithm (Appendix A.2.6 “Firmware for the
Signal Analysis PICtail Daughter Board”), the table
values outside the valid range take on the nearest valid
value. This means that when ADC code > 1008, the
table returns a value of -49.3°C. When ADC code < 16,
the table returns a value of 156.1°C.
DS00897B-page 3