AN897
PIECE-WISE LINEAR INTERPOLATION TABLE
0.04
0.03
0.02
0.01
0.00
-0.01
-0.02
-0.03
-0.04
Each of the three gains uses a piece-wise linear inter-
polation table [9] to convert ADC codes to estimated
temperature. Within each table, the ADC’s codes were
divided into 64 segments, with 16 codes per segment.
The tables only include those ADC codes at the end
points between segments. Table 3 shows the extreme
valid table entries for each of the three tables.
Design # 2
TABLE 3:
INTERPOLATION TABLE END
POINTS.
-50 -25
0
25
50
75 100 125 150
Thermistor Temperature (°C)
Gain
(V/V)
ADC Code
TTH
(°C)
RTH
(Ω)
VOUT
(V)
(LSb)
FIGURE 17:
Piece-wise Linear
Interpolation Error, Design # 2.
1
960
112
960
224
960
208
-43.5
51.2
49.2
94.9
92.6
150.9
420k
3.44k
3.72k
787
4.688
0.547
4.688
1.094
4.688
1.016
The digital roundoff error will be roughly proportional to
the ADC temperature resolution curve’s envelope (see
Figure 13). If the roundoff error is much less than the
ADC resolution, this error will have little impact.
8
32
845
The total digital error includes both the piece-wise lin-
ear interpolation error and round-off error.
179
Values of TTH and RTH beyond the specified tempera-
ture range of the thermistor (-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 3.
DESIGN COMPARISON
Figure 18 shows the thermistor’s specified accuracy. It
contributes the same error to both designs.
The table’s entries go outside of -40°C to +150°C 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 G = 1 and ADC code > 960, the
table returns a value of -43.5°C. When G = 32 and
ADC code < 208, the table returns a value of 150.9°C.
2.0
BC Components®
1.8
# 2322 640 55103
1.6
10 kΩ @ +25°C
1.4
1.2
1.0
0.8
0.6
0.4
0.2
0.0
The other table entries beyond the end points in Table 3
(e.g., near gain-change points) are zero because the
hysteresis algorithm will prevent them from being read.
This approach has been used for readability.
-50 -25
0
25
50
75 100 125 150
Thermistor Temperature (°C)
FIGURE 18:
Thermistor Accuracy.
Digital Error Analysis
Figure 19 compares the ADC temperature resolution
between the first and second design. The second
design is better because changing the PGA’s gain
helps improve the ADC temperature resolution.
Figure 17 shows the estimated interpolation error for
the interpolation table. Changing the PGA’s gain takes
full advantage of the ADC’s resolution. The accuracy of
this piece-wise linear interpolation table is 0.034°C
over the -40°C to +150°C temperature range. The
improved ADC temperature resolution makes this
design’s piece-wise linear interpolation table behave
much better than the first design’s.
2004 Microchip Technology Inc.
DS00897B-page 7