That's because you have left justified the ADC result in ADRESL and ADRESH.
Set the adcon0 to %10000001.
Also you have this calculation:
What about LM35_Vout being less than LM35_VGND?Code:Temperature = (LM35_Vout - LM35_VGND) * 100
I expected you would do this and noted in earlier post (#33)
The simplest way is to have an if-then check first like this:
IoannisCode:if LM35_Vout >LM35_VGND then Temperature = (LM35_Vout - LM35_VGND) * 100 else if LM35_Vout <= LM35_VGND then Temperature = (LM35_VGND - LM35_Vout) * 100 endif





Bookmarks