Have you considered first to suppress all analogical problem you may have ? Like analogic ground, the point where you connect the analogic input voltage, the garbage on your Vcc supply ( assuming you still use switching PSU for test) etc. 100nF and 10uF directly on PIC supply pins. Usual no cap are required from ad input to gnd. If you still want them, use a small signall input impedance and no more than 47nF. And of course if your analogic signal is comming from elswere, then check first how clean is. Delay must be at least 20uS. A leackage offset is temperature dependent. You have another problem there. regards, Vasile http://www.geocities.com/vsurducan On Wed, 12 Jun 2002, Micro Eng wrote: > Some more information.... > > after reading thru the posts.....seems to be a couple of avenues to go down. > > The first is increase the setup time. Second is to add a capacitor to ground > on the pin. Haven't tried this, as it seems to be in discussion if this is > even a correct approach. > > There is two problems still...accuracy and multiple channel reads. > > I changed the code to read in just a single input,and modified the setup > delay values. I started with 255, ranged down to 10. > > ; xtal is 4.194 Mhz > > AD_read > movwf ADCON0 > call ADSetup > bsf ADCON0,GO ; Start first A/D conversion > btfsc ADCON0,GO > goto $-1 > movf ADRESH,W ; Get A/D value and put in W reg > return ; return with value in W > > > ADSetup > movlw d'5' > movwf DelayAD > decfsz DelayAD,f > goto $-1 > > I put in a breakpoint right after the call to read, and a watch window to > look at the data. > > The first time thru, after being reprogrammed, from an expected value of > d'178' for a voltage of 3.5V, the value is 178 with a delay of 10, or if the > value is '255' for the delay, the first read is 186. The second time and > all reads after that, read '187'. The interesting thing is from a range of > 1.5V up to 3.5V, the expected value vs the final stable value all have a > difference of 7 bits. Someone mentioned the leakage current could produce > such an offset. I can deal with an offset if I knew it was constant, but > why the initial reading be closer to the actual value and the readings after > that be stable. > > So, as a result, the setup delay doesn't seem to have a large difference, > although I would expect it to actually. Is there another delay that I didnt > account for? > > And this still hasn't looked at the multiple channel reads either. > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.