unsigned int adc_rd;
char txt[5];
unsigned int adc_rd2;
char txt2[5];
void main() {
INTCON = 0; // disable all interrupts
ANSEL = 0x06; // Configure AN2 pin as analog input
TRISA = 0x06;
ANSELH = 0; // Configure other AN pins as digital I/O
Lcd_Config(&PORTB, 4, 5, 6, 3, 2, 1, 0); // Lcd_Init_EP5, see Autocomplete
LCD_Cmd(LCD_CURSOR_OFF); // send command to LCD (cursor off)
LCD_Cmd(LCD_CLEAR); // send command to LCD (clear LCD)
ADCON1 = 0x82; // configure VDD as Vref, and analog channels
ADCON0 = 0x82;
TRISA = 0xFF; // designate PORTA as input
while (1) {
adc_rd = ADC_read(1);
adc_rd2 = ADC_read(2);
LongToStr(adc_rd, txt);
LongToStr(adc_rd2, txt2);
LCD_Out(2,1,txt);
LCD_Out(1,1,txt2);
Delay_ms(10);
}
}