Log in

View Full Version : First ADC conversion in a sequence always returns lower result 18F14K50



ChrisKiwi
- 21st January 2011, 12:51
Hi all, Just wondering if anybody has ever come across this before.... just asking in case someone has observed this before....the work around is obvious, but I'd prefer to fix it.

I am using 2 ADC channels to take 3 samples in a loop, configuring the ADC to use the first channel, resetting the ADC, delay 10uS, then the second channel, resetting the ADC, delay 75uS then the first channel again, etc.

The code works fine except for the fact that the first conversion is always about 5 counts low. This channel is supplied by an op amp buffer (capable of supplying +/-30mA), it's input is from CVref output of the PIC. The second channel is supplied from a 10K pot on the development board, with no buffer.

If I reverse the connections to the ADC channels I still get a low first reading.

After the first conversion, every subsequent conversion is stable, regardless of which voltage source is used.

The TAD and Fosc/X are all within the allow parameters and changing them or adding extra delay before the first conversion has no effect.

It appears that after a certain time of inactivity the ADC will always return a low first conversion result. It's kind of like getting in your car on a cold morning and having to give the engine a bit of a rev to really get the car going.

Regards
Chris

Acetronics2
- 21st January 2011, 21:11
Hi, Chris

May we get the ADC loop code snippet ???

Alain

ChrisKiwi
- 22nd January 2011, 02:58
Hi, Chris

May we get the ADC loop code snippet ???

Alain

Hi Alain,

I new somebody would ask that !

Which is why I posted in "Off Topic", because I am modifying the original PBP code (I wrote) to suit new hardware using Microchip C18 to appease a university lecturer I am working with on a summer research project. I think I have solved the problem, as it happens. The C18 compiler is quite strict when it comes to the order of precedence, where PBP is quite forgiving. The Microchip forums can be full of point scorers, this forum is not, hence, I thought I'd try my luck here, in case someone had had the same problem and could give me some general clues as to where to start looking.
Regards
Chris