The following equation provides an estimate for the die temperature based on the above parameters:
ADCMEAS = ADC reading at temperature being estimated
Gain = Gain value stored in the DIA table
Offset = Offset value stored in the DIA table
// offset is int16_t data type
// gain is int16_t data type
// ADC_MEAS is uint16_t data type
// Temp_in_C is int24_t data type
ADC_MEAS = ((ADRESH << 8) + ADRESL); // Store the ADC Result
Temp_in_C = (int24_t)(ADC_MEAS) * gain; // Multiply the ADC Result by
// Gain and store the result
// in a signed variable
Temp_in_C = Temp_in_C / 256; // Divide (ADC Result * Gain) by 256
Temp_in_C = Temp_in_C + offset; // Add (Offset) to the result
Temp_in_C = Temp_in_C / 10; // Divide the result by 10 and store
// the calculated temperature