Hello,
I'm working with a TMS320F28062F and I would like to convert the value of an NTC thermistor in °C (I'm a new user of C2000 MCU).
My schematic is 3V3 -> NTC thermistor (10K @ 25°C) -> ADC measure -> 2K2 resistor -> GND.
First, I calculate the resistor value of the NTC :
Vr = ADCmeas * ADC scale factor = ADCmeas * (Valim / 4095) = ADCmeas * (3.3/4095) = ADCmeas * 0.0008058608
Rntc = R * ((Valim - Vr)/ Vr)
After that I would like to calculate the temperature in °C with the Steinhart-Hart equation
T = (1 / A + (B * ln(Rntc)) + (C * (ln(Rntc))^3)) - 273.15
here is my code :
_iq value;
_iq Adc_SF = _IQ(0.0008058608);
_iq Fixed_Resistor = _IQ12(2200.0);
_iq Voltage_3V3 = _IQ18(3.3);
_iq Steinhart_coeff_A = _IQ(0.000865282);
_iq Steinhart_coeff_B = _IQ(0.000254940);
_iq Steinhart_coeff_C = _IQ(0.000000183);
// convert temperature bridge A
value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_7); // ADC measure
value = _IQmpy((value<<18),Adc_SF); // ADC 12 bits exponent multiply by ADC scale factor
value = _IQ18div((Voltage_3V3 - value),value); // (Valim - Vr) / Vr
value = _IQ12mpy((value>>6),Fixed_Resistor); // Resistor's value of NTC (18 bits exponent because 188500 ohms @ -40°C)
value = _IQ12div(_IQ(1.0),(Steinhart_coeff_A + _IQmpy(Steinhart_coeff_B,log(value)) + _IQmpy(Steinhart_coeff_C,pow(log(value),_IQ(3.0))))); // Temperature in °C
pAdcData->T.value[0] = value;
I can read the resistor's value of NTC but not the result of the Steinhart-Hart equation.
Please, help me.
Thank you in adavance,
Best regards,