1: /* 2: * Read the ADC. 3: */ 4: 5: 6: #include "pic1687x.h" 7: #include "adc.h" 8: 9: 10: void 11: adc_read(unsigned char channel) 12: { 13: 14: ADCON0 = (channel << 3) + 0xC1; // enable ADC, RC osc. 15: ADGO = 1; 16: while(ADGO) 17: continue; // wait for conversion complete 18: }; 19: 20: 21: 22: