LP2901 is a comparator , the output can be either high or low (you actually need a pull up resistor for high), I can not see how you can use it as a temperature sensor.
In addition you have a resistor in series with the positive supply , what is that?
LM335 is the way to go (or any other similar sensor) , the voltage changes according to the temperature so you have to measure it with an ADC and calculate the temperature that the measured voltage represents.
This is a nice tutorial , see if it helps: Temperature sensor tutorial - Using the TMP36 / LM35
Device 16F876A
Declare Xtal 4
Declare Adin_Res 10 ' 10-bit result required
Declare Adin_Tad 8_FOSC ' Set the ADC's clock source
Declare Adin_Stime 50 ' Allow 50us sample time
Declare LCD_Type 0 ' Type of LCD Used is Alpha
Declare LCD_DTPin PORTB.4 ' The control bits B4,B5,B6,B7
Declare LCD_RSPin PORTB.2 ' RS pin on B2
Declare LCD_ENPin PORTB.3 ' E pin on B3
Declare LCD_Interface 4 ' Interface method is 4 bit
Dim temperature As Float 'temperature value
Dim result As Float ' adc value handler
ADCON1 = %10000000 ' Set all to analogue inputs (PORTA)
Print $FE,$40,$1C,$14,$1C,$07,$04,$04,$07,$00 ' custom character for degree celsius
cls
Main:
result = ADin 0 , grab a sample from porta.0
result = (result * 5000) / 1024 scale the result
temperature = result / 10 ' remember 10mV = 1 degree when using LM35
print at 1, 1, "TEMPERATURE: ", dec2 temperature, 0
delayus 100
goto main
It is converting,result = (result * 5000) / 1024
Ah yes sure, tested everthing but it's not so accurate, when i select for example 50 °C in the LM35, on lcd show 48,82 °C . How can I fix it if possible?
It is converting,
10 bit ADC result -to-> 'output in mV' against 5V reference
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?