C8051F39x/37x
8. Precision Temperature Sensor
(C8051F390/2/4/6/8 and C8051F370/4 Only)
The precision temperature sensor is a self-contained module that reports the die temperature in degrees
Celsius. For the temperature sensor accessed by the ADC, refer to Section 10.
The precision temperature sensor begins a conversion once the TS0STRT bit is set to 1 then cleared to 0
by firmware. The conversion length is specified by TS0CNVL, with a longer conversion time resulting in a
more accurate temperature measurement. The TS0DN bit is set by hardware once the temperature sensor
block has completed the measurement, and the temperature is available in TS0DATH:TS0DATL.
The precision temperature sensor may also be enabled as an interrupt source by setting the EPTS bit in
EIE2. When enabled, the interrupt occurs once TS0DN is set to 1 by hardware.
8.1. Temperature in Two’s Complement
The 16-bit word in TS0DATH:TS0DATL is the temperature in degrees Celsius represented in two's com-
plement with 1 weighted sign bit, 8 integer bits, and 7 fractional bits. Equation 8.1 converts the value in
TS0DATH:TS0DATL from two’s complement binary to decimal.
6
7
n – 7
8
Temperature in C = – TS0DATH7 2 +
TS0DATHn 2n + 1
+
TS0DATLn 2
n = 0
n = 0
Equation 8.1. Temperature Conversion from Two’s Complement Binary to Decimal
Where:
th
TS0DATH[n] is the n bit in TS0DATH
th
TS0DATL[n] is the n bit in TS0DATL
Table 8.1 lists several 16-bit values in TS0DATH:TS0DATL and the corresponding temperature.
Table 8.1. Example Temperature Values in TS0DATH:TS0DATL
Hexadecimal
0x3480
0x1400
0x0CE0
0x0080
0x0040
0x0001
0x0000
0xFFFF
0xFFC0
0xFF80
0xF320
0xEC00
Binary
Temperature (°C)
0011 0100 1000 0000
0001 0100 0000 0000
0000 1100 1110 0000
0000 0000 1000 0000
0000 0000 0100 0000
0000 0000 0000 0001
0000 0000 0000 0000
1111 1111 1111 1111
1111 1111 1100 0000
1111 1111 1000 0000
1111 0011 0010 0000
1110 1100 0000 0000
105
40
25.75
1
0.5
1/128
0
–1/128
–0.5
–1
–25.75
–40
Preliminary Rev. 0.71
45