hckeat
Newbie level 5
lm35dz circuit pic
Hi, I'm new here and new to PICBasic as well.
I'm working on a project which I was required to use several temperature sensors (LM35DZ) to measure the temperature inside each room and another temperature sensor to measure the atmospheric temperature. When there is huge difference of reading between atmospheric temperature with any of the temperature sensor inside, PIC16F877A will turn on a buzzer.
Since I am new, so I started by doing the simple thing, which is to show the temperature reading of single LM35DZ using a LCD. Here's my PICBasic code below:
DEFINE osc 20
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
define ADC_BITS 10
define ADC_CLOCK 3
define ADC_SAMPLEUS 50
lmtemp var word
temp var word
TRISA = %11111111
ADCON1 = 0
Start:
ADCIN 0, lmtemp
temp = (lmtemp*5)/10
Lcdout $fe, 1
Lcdout "Temp = ", dec temp,"C"
pause 100
goto start
LCD is working fine, by showing the word "Temp =", but the reading of temperature is wrong, which is "417C"!
The output of LM35DZ is direct input to AN0, when I measured the output voltage of LM35DZ, it is 4.06V. I decided to remove the output of LM35DZ from PIC and measure the output voltage again, which is the correct now, 0.28V (28 deg C). I was wondering what was the problem cos the code looks OK for me.
Hope you guys can help me up with this. Thanks
Hi, I'm new here and new to PICBasic as well.
I'm working on a project which I was required to use several temperature sensors (LM35DZ) to measure the temperature inside each room and another temperature sensor to measure the atmospheric temperature. When there is huge difference of reading between atmospheric temperature with any of the temperature sensor inside, PIC16F877A will turn on a buzzer.
Since I am new, so I started by doing the simple thing, which is to show the temperature reading of single LM35DZ using a LCD. Here's my PICBasic code below:
DEFINE osc 20
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
define ADC_BITS 10
define ADC_CLOCK 3
define ADC_SAMPLEUS 50
lmtemp var word
temp var word
TRISA = %11111111
ADCON1 = 0
Start:
ADCIN 0, lmtemp
temp = (lmtemp*5)/10
Lcdout $fe, 1
Lcdout "Temp = ", dec temp,"C"
pause 100
goto start
LCD is working fine, by showing the word "Temp =", but the reading of temperature is wrong, which is "417C"!
The output of LM35DZ is direct input to AN0, when I measured the output voltage of LM35DZ, it is 4.06V. I decided to remove the output of LM35DZ from PIC and measure the output voltage again, which is the correct now, 0.28V (28 deg C). I was wondering what was the problem cos the code looks OK for me.
Hope you guys can help me up with this. Thanks