Connect your Pot (say 10K as a reasonable value) between Vss (0v) for the bottom end of the Pot, and Vdd (5v) for the top end of the Pot. The wiper of the Pot connects directly to your chosen PIC pin (in my example below it's RA0/AN0). See ADCIN command in PBP manual for further information also reference with the PIC's Datasheet. LCD defines not shown - add appropriately.
MyVar var Byte
CMCON=%00000111
' see Datasheet 12.1
ADCON0=%11000001
' see Datasheet 11.1
ADCON1=%00001110
' see Datasheet 11.2
TRISA=%00000001 ' Set RA0/AN0 to Input
Pause 1000 ' Wait for LCD to Initialise
LCDOut $FE,1 ' Clear Screen
Loop:
ADCIN 0,MyVar ' Get Value
LCDOut $FE,$80,DEC3 MyVar ' Overwrite with New Value
Pause 100
Goto Loop
Note, my example ONLY defines RA0/AN0 pin as ADC Analogue. If you want to add further pins, change TRISA and ADCON1 appropriately.
Melanie
Bookmarks