See if this works. If not, it might be due to your older version of PBP. I know
they've made a few changes/fixes for the 18F series since v2.43.
Tested with PIC18F452 PBP v2.46:
Code:
' Lab-X1 LCD definitions
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 LCD_COMMANDUS 2000
Define LCD_DATAUS 50
n_samples CON 300
Sample_Buffer var word[n_samples] 'Array to store samples in
Sample_Index var word
ADC_Buffer var word 'Return value for ADC_Reading
CLEAR
ADCON1 = 7 ' Set PORTA and PORTE to digital
ADC_Buffer = 1200
PAUSE 1000
lcdout $fe,1 ' Cls Clear LCD screen
Main:
FOR Sample_Index = 0 to 299
Sample_Buffer[Sample_Index] = ADC_Buffer
ADC_Buffer = ADC_Buffer + 100
LCDOUT "Sample: ",DEC Sample_Index," = ",DEC Sample_Buffer[Sample_Index]
PAUSE 2000
LCDOUT $fe,1 ' Cls Clear LCD screen
NEXT Sample_Index
GOTO Main
end
Bookmarks