Hi,
I wrote a thermistor resistance value to temperature conversion program by the combination of PIC18F57K42 & MPLAB x IDE. Inside the conversion, I am using log calculation. I got a value using c compiler, but that value is not same as the calculator value. Here i attached one simple c code. #include <stdio.h>
#include <math.h>
void main()
{
float Rth=29498.553;
float Rr=50000;
float a;
a = log (Rth/Rr);
printf("a = %f", a);
}
////////////////////
a = - 0.527682 ////after compiling i got that value. But the calculator value is -0.22916929139
I am also changing data type float to double, but i got only the same value. Please let me know, what is making wrong...
I am using the following formula for conversion: Tkelvin = (beta * room_temp) / (beta + (room_temp * log (Rthermistor / Rroom_temp_res))) . Is it correct or else please suggest other than that one.
Advance in thanks...!