You are on page 1of 1

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 ADCIN parameters
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
ADCON1 = %10000010 ' Set PORTA analog and right justify result
x var byte
TRISB = %00000000
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %00000010 ' Set PORTA analog and LEFT justify result
ADCON0 = %11000001 ' Configure and turn on A/D Module
Pause 500 ' Wait .5 second
loop:
ADCON0.2 = 1 ' Start Conversion
ree:
If ADCON0.2 = 1 Then ree ' Wait for low on bit-2 of ADCON0 conversion fin
ished
x = ADRESH
xx=2*x
Lcdout $fe, 1 ' Clear LCD
Lcdout "Reading is :" ' Display
lcdout $fe,$c0," ",dec xx
goto loop

note :: connect the lm35 output to A2 from the pic


good luck

You might also like