#include <16F876.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_B1, rcv=PIN_C7)
#include <input.c>
#include <ad8400.c>
void main() {
int value;
char pot_num;
setup_adc_ports (ALL_ANALOG);
setup_adc (ADC_CLOCK_INTERNAL);
init_pots ();
do {
set_adc_channel (0);
delay_us (100);
value = read_adc ();
printf ("\n\r\n\rInput 1: %2X ", value
);
if (NUM_POTS > 1) {
set_adc_channel (1);
delay_us (100);
value = read_adc ();
printf ("Input 2: %2X \n\r", value
);
do {
printf ("\n\rChange pot 1 or 2?"); } while ((pot_num!='1') && (pot_num!='2'));
}
else
pot_num = '1';
printf ("\n\rNew pot pot_value:"); value = gethex ();
set_pot ((pot_num-'1'), value);
} while (TRUE);
}