Post Go back to editing

ADuC7124: Temperature sensor sampling queries - low starting point

Hi,

Issue: The first measurement of temperature given an ambient temperature of 22.0 deg C is about 9.5 deg C. After this, the temperature measurement is only slowly increasing, to match a more reasonable temperature. This is over the course of 30 seconds or so. I'm trying to understand why this is. What I do is to let Timer 0 runt at 4 kHz and generate interrupts, to sample 4 channels in total - 2 of these channels are the temperature sensor sampled twice (after each other). Sampling rate per channel is thus 1 kHz. ADC interrupt is enabled, so reading and postprocessing of ADCDAT is carried out as soon as conversion has completed.

The flow for sampling the temperature sensor is as follows:

Do the following for i=0 and i=1:
(Timer 0 interrupt)
ADCCP = 16;
TSCON = 1;
ADCCON = 0x37A3;
ADCCON &= ~(1<<7);
(ADC interrupt)
Val[i] = ADCDAT>>16:
(Postprocessing with Val[i])
if i==1, compute the temperature based on the mean of Val[0] and Val[1].

What is also observed is that Val[0] and Val[1] are between 200 and 500 LSB apart , depending on temperature, with Val[1] being larger. This is always the case.
I have tried adding NOPs after "TSCON = 1;" to add a little delay, but no difference.

I'm also using the TEMPREF register using the guidance of the data sheet. For the board I'm testing on, the MCUs TEMPREF register is 38, corresponding to a VTref of 1.422V.

In short: The temperature measurement seems to be very reasonable as time passes, but am concerned about the differences in Val[0] and Val[1] and the fact that it starts out at a very low temperature and takes a long time to converge. Is this to be expected?

Thanks.