Define CLOCK_FREQUENCY = 16
Define LCD_LINES = 4
Define LCD_CHARS = 20
Define LCD_BITS = 4
Define LCD_DREG = PORTD
Define LCD_DBIT = 0
Define LCD_RSREG = PORTC
Define LCD_RSBIT = 6
Define LCD_EREG = PORTC
Define LCD_EBIT = 7
Define LCD_RWREG = PORTD
Define LCD_RWBIT = 0
Define ADC_SAMPLEUS = 50
Define ADC_CLOCK = 7 'ADC input Prescaler Selections = 128
Define ADC_VREF = 1 'AVCC with external capacitor on AREF pin
DDRD.4 = 0 'input ADC8
DDRD.6 = 0 'input ADC9
Dim pot As Word
Lcdinit 0
WaitMs 500
pot = 0
main:
Gosub GetADC_9
Lcdcmdout LcdLine1Home
Lcdout "Potentiometer"
Lcdcmdout LcdLine2Home
Lcdout #pot
WaitMs 200
Goto main
End
GetADC_9:
ADMUX.MUX0 = 1
ADMUX.MUX1 = 0
ADMUX.MUX2 = 0
ADMUX.MUX3 = 0
ADMUX.MUX4 = 0
ADMUX.ADLAR = 1
ADCSRB.MUX5 = 1
ADCSRA.ADEN = 1
ADCSRA.ADSC = 1
ADC_Read 8, pot
Return