Hello everybody,

I am trying to read the temperature of the CPU core,but i am getting some weird readings.

Here's the code:

float K60_temp()

{

float data = 0.0;

float V_temp = 0;

float V_temp_25 = 0;

float slope_m = 0;

temp_uc_adc3_StartSingleMeasurement(core_temp);

while (!temp_uc_adc3_GetMeasurementCompleteStatus(core_temp)) {}; /* Wait for conversion completeness */

temp_uc_adc3_GetMeasuredValues(core_temp, (LDD_TData *) (&cpu_temp_adc_count)); /* Read measured values */

V_temp = 0.100708*cpu_temp_adc_count;//(3300/32768)*cpu_temp_adc_count;

V_temp_25 = 716.00;//mV

slope_m = 1.62;//or 1/m = 0.61728mV

data = (float)((float)(V_temp - V_temp_25)*0.61728)/10;

return data;

}

When i increase the core temp(using a hot air gun),the temperature decreases!!

Isn't it supposed to happen the other way around?

Kindly help,

Arun

I think your 'data' needs to be 25.0 minus the rest you show (except NOT a /10??) -- the calculation you show does give you the DIFFERENCE to the calibrated results at 25C.

I am also a little confused as to where you got your /32768 divisor in ADC calculation -- seems to me I would expect a 16-bit 'full scale' span, so each LSB (from 3.3V) is 3300/65536mV.

See also:

Re: K70 Temperature reading - Slopes