Hi,
The datasheet says not to set ADON and GO/DONE bits at the same time. I don't know why and I'd guess it's got nothing to do with the problem but you never know. First set up and turn on the ADC in your initialisation, then flip the GO/DONE bit (ADCON0.1 = 1) when you want to start a conversion.
Your comments in the code says the pot input is on GP1. The code does not set GP1 to input and does not set GP1 to analog. In a previous message though you said you had moved the pot input from GP1 to GP0 (which matches the TRIS and ANSEL setting) but if so it looks like your trying to sample the wrong input because ADCON0=%00000111 would sample GP1.
You also seams to have CM-/GP1/AN1 configured as input to the comparator - don't know if that may present a problem.
Well, not much concrete but atleast something to look into. I'd probably try getting the ADC running outside the interrupts to begin with it. Start it, poll the interrupt flag, get the result (or even use ADCIN for that matter). Then, when that works move it to interrupts.
BTW, you're currently trying to sample as fast as it can possible go. As soon as one conversion is done and serviced you start the next. You'll spend a lot of time jumping in and out of the AD interrupt routine that way and the value doesn't get used untill the timer overflows. Since the timer is only reloaded when it overflows why not sample the pot in the timer interrupt as well?
/Henrik.
Bookmarks