PDA

View Full Version : First GetADC using DT_Analog.pbp incorrect measurement afterwards is good. Why?



BryanSw
- 17th June 2015, 14:42
I am using Darrel Taylor's DT_Analog.pbp for taking analog measurements. Measurements are taken in a loop using GetADC.
The first ADC measurement is always an incorrect value. After the first measurement, all consecutive measurements are correct.
To get around this I do a single measurement first. Then I run my loop to take multiple measurements using GetADC. What is the reason the first measurement is always bad or incorrect?

Your help is always greatly appreciated.

Bryan

Demon
- 17th June 2015, 17:28
Hard to comment without seeing any code.

Does the PIC have time to stabilize before taking the first reading?

What if you add a short PAUSE?

Robert

AvionicsMaster1
- 23rd June 2015, 13:58
At least for the 12F683 it has a charge holding capacitor in the ADC circuit. The way I understand it that needs to be give the appropriate amount of time to charge fully before you take a reading. That time may change depending on which chip you're using.

My guess is that Demons suggestion of a short pause would solve the problem. Or a counter that won't allow display until the appropriate time has elapsed. Either gives the ADC a chance to stabilize and provide the correct reading.