Hi Eng_Bandar,
take care of Proteus.
Change the resolution of LM35 to 0.1 degrees C and of the voltmeter to millivolts an see that your aproximations are very satisfactory.
With 5.0 degrees I got 51.2 mV not 50.0 mv. What you see is not always you get! adc will be 10 and adc2 will be 4.9. And the remaining numbers should be because of float conversion.
And remember there is a quantization error of the analog converter also.
And there is a problem with LCD updating because with 5.0 deggres it must show exactly 4.9 not 4.969999... The .069999 is leftovers from previous display.
With the simulation not running, set the LM35 to 5.0 and run it to see what happens...or insert this command:
Code: Select all
lcd_cmd(_LCD_CLEAR); //add this line
lcd_out(2,5,k);
delay_ms(1000);
If you need more precision you should use Vref+ set to 1.50V and change the math, because now 1.50V (150 degrees) is really 1023 to the ADC.
BR.
EDIT: for negative numbers you should offset the output voltage by 0.55V, i.e., for 0 degrees the output should be 550mV.
You'll need some hardware to get this. AN-460 from National semiconductors is a good reference.