K60 temperature reading_wierd behaviour

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K60 temperature reading_wierd behaviour

Jump to solution
835 Views
arunkumar1989
Contributor I

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

Labels (1)
0 Kudos
1 Solution
649 Views
egoodii
Senior Contributor III

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

View solution in original post

0 Kudos
2 Replies
650 Views
egoodii
Senior Contributor III

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

0 Kudos
649 Views
arunkumar1989
Contributor I

Thanks for the reply Earl,i did the calculation thinking the adc is a 15 bit adc(2^15 = 32768),i corrected it now,the mentioned link helped a lot.

It is showing correct readings now.

Here's the function:

float uc_temp()

{

    float V_temp = 0;

    float V_temp_25 = 0.719;

    float slope_m = 0.00162;    //1/m = 617.283

    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 */

    //convert count to volts

    V_temp = (3.3/65536) * cpu_temp_adc_count;

    //temp at 25c in volts

    //V_temp_25 = 0.719;

    //slope in volts

    //slope_m = 0.00175;

    //return 25 - ((V_temp - V_temp_25)/slope_m);

    return 25 - ((V_temp - V_temp_25)*617.28F);

}

0 Kudos