Hi all , i want to build a LCD thermometer with this two components but it seems i have a problem. When LM35 it's not connected to RA1 (analog imput) the temperature-voltage dependence it's correctly indicated (270mv-27C, 280mv-28C,,etc), but when i connect the output of LM35 to analog imput of PIC16f877a the output voltage of LM35 it's remain the same (145mv) all the time and there are not changes of voltage with temperature anymore. The power supply =5V.I don't know what is the problem.
The ASM code that i've writed (at the end of the convertion, the 8 bit are transfereted to the PORTB in order to see changes), and it is working perfectly with a potentiometer (10K) connected to Vss, Vdd and RA1:
#include <p16F877.inc>
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC &_WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
org 0x00
t equ 0x20
q equ 0x21
s equ 0x22
x equ 0x23
y equ 0x24
z equ 0x25
movlw b'10001001' ;
movwf ADCON0
bsf STATUS,RP0
movlw b'00000000'
movwf ADCON1
comf TRISA
clrf TRISB
clrf TRISC
clrf TRISD
clrf TRISE
bcf STATUS,RP0
clrf PORTB
clrf PORTA
loop1
call loopaa
bsf ADCON0,2 ; start conversie
loop
btfsc ADCON0,2
goto loop
movf ADRESH,w
movwf PORTB
goto loop1
loopaa
movlw 0xaf
movwf x
movlw 0xaf
movwf y
movlw 0x0a
movwf z
delay1
bcf STATUS,2
decf x,1
btfss STATUS,2
goto delay1
bcf STATUS,2
movlw 0x10
movwf x
decf y,1
btfss STATUS,2
goto delay1
movlw 0xaf
movwf x
movlw 0xaf
movwf y
decf z,1
btfss STATUS,2
goto delay1
return
nop
end
thanks
The ASM code that i've writed (at the end of the convertion, the 8 bit are transfereted to the PORTB in order to see changes), and it is working perfectly with a potentiometer (10K) connected to Vss, Vdd and RA1:
#include <p16F877.inc>
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC &_WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
org 0x00
t equ 0x20
q equ 0x21
s equ 0x22
x equ 0x23
y equ 0x24
z equ 0x25
movlw b'10001001' ;
movwf ADCON0
bsf STATUS,RP0
movlw b'00000000'
movwf ADCON1
comf TRISA
clrf TRISB
clrf TRISC
clrf TRISD
clrf TRISE
bcf STATUS,RP0
clrf PORTB
clrf PORTA
loop1
call loopaa
bsf ADCON0,2 ; start conversie
loop
btfsc ADCON0,2
goto loop
movf ADRESH,w
movwf PORTB
goto loop1
loopaa
movlw 0xaf
movwf x
movlw 0xaf
movwf y
movlw 0x0a
movwf z
delay1
bcf STATUS,2
decf x,1
btfss STATUS,2
goto delay1
bcf STATUS,2
movlw 0x10
movwf x
decf y,1
btfss STATUS,2
goto delay1
movlw 0xaf
movwf x
movlw 0xaf
movwf y
decf z,1
btfss STATUS,2
goto delay1
return
nop
end
thanks