Are you using a 16F877 or 16F877A?
Probably doesn't matter much, but, put the config registers first, then your define's, then you variables, then your code.
Code:
@ DEVICE pic16F877
@ DEVICE pic16F877, WDT_on
@ DEVICE pic16F877, PWRT_ON
@ DEVICE pic16F877, PROTECT_OFF
@ DEVICE pic16F877, HS_OSC
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 1
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 0
DEFINE LCD_RWREG PORTE
DEFINE LCD_RWBIT 2
DEFINE LCD_BITS 8
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 1000
DEFINE LCD_DATAUS 225
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 2
DEFINE ADC_SAMPLEUS 100
bar var byte:raw var word:I var byte
trisa=1:trisb=0:trise=0:lcdout $FE,$40,0,$1F,$1F,$1F,$1F,$1F,$1F,0,$fe,1
ADCON1=$8e:PAUSE 200:ADCIN 0,raw:bar=(1023-raw)/64:lcdout $fe,2:for I=1 to bar
lcdout ,255:next I
END
Looks like something might be missing from that lcdout command...(and the next I shouldn't matter, but it might).
How do you know you ADCIN is actually reading something?
Have you tried just reading the RAW value and displaying it in a loop?
lcdout DEC3 RAW
Bookmarks