TucsonDon
Member
I have a project that I am working on that I'm using the ADC on a PIC18F45K22 with a thermistor. I am converting the ADC output to degrees but I need to convert a double to an ascii string.
I am using MPLab IDE with xc8 compiler. It has itoa the library but no file to do what I need.
double Thermistor(int RawADC)
{
double Temp;
Temp = log(10000.0*((1024.0/RawADC-1)));
// =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration
Temp= 1/(0.001129148 +(0.000234125 +(0.0000000876741 * Temp * Temp ))*Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celcius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celsius to Fahrenheit
return Temp;
}
I am using MPLab IDE with xc8 compiler. It has itoa the library but no file to do what I need.
double Thermistor(int RawADC)
{
double Temp;
Temp = log(10000.0*((1024.0/RawADC-1)));
// =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration
Temp= 1/(0.001129148 +(0.000234125 +(0.0000000876741 * Temp * Temp ))*Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celcius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celsius to Fahrenheit
return Temp;
}