Hello all, An update of this. It turns out that the 'actual source' depicted in the circuit diagram below had some capacitive impedance as well (and other elements), so the total equivalent 'holding' capacitor was actually larger than the 120 pF of the internal CHOLD from the PIC S&H circuit. The equivalent circuit diagram looks like this: 50 Ohm 1uH PIC's RAx -+-------+----/\/\/\/\--+---{}{}{}--+--- ideal source | | | | -- / | | / 5V1 \ 10K | 100pF | 100pF /\ / --- --- -- \ --- --- | | | | -+- -+- -+- -+- /// /// /// /// Note the two extra capacitors, plus the inductor (the whole set acts as an input filter), and also there's a Zener for protection. I modified my code and made the acquisition time much larger. Microchip was recommending 20 us for a non-capacitive load, I made it 320 us just to be on the safe side. 320 us should be more than enough :) The result is that the error has been reduced as I'm now reading $002 instead of $004 or $008 in the 'unused' channels. This happens on all channels that are unused, not only in the one that is sampled after the 'active' 4V one (see the original msg below for the details), so I assume that the acquisition is no problem anymore and that what I'm now seeing is only noise or something else. Question is, is it normal to have so much noise so as to affect 2 bits of the converted value? Any hints on how could I reduce this effect? G. At 17:14 24/06/2002 +0200, Guillermo Rodriguez Garcia wrote: >Hi all, > >I have an application running on a 16F872 @ 20 MHz that >(among other things) reads and converts data from three >analog channels connected to RA0, RA1, and RA3. The ADC >clock is selected as Fosc/32, so Tad = 1.6 us (Tad is >the bit conversion time). > >Each channel is connected as follows: > > 50 Ohm >PIC's RAx ---------+---------/\/\/\/\----------- actual source > | > / > \ 10K > / > \ > | > -+- > /// > >So the impedance seen from the PIC should be somewhere between >50 Ohm and 10 K. > > >Software side of things: > >1. I select the channel. > >2. Then I am allow for an acquisition time of 22 us (the datasheet > mentions 20 us for a 10 K source) > >3. Then I start the conversion (set the 'GO' bit) > >4. Once the conversion is over, I wait _at least_ 11 us (the > datasheet also mentions that a delay of 2 x Tad needs to be > honoured here) > >5. Go back to step 1, but with the next channel. > > >Now my problem is the following: I just set one of the three channels >(let's say RA0) to a 4V source, and leave the other two (RA1 and RA3 >in this example) unused (i.e. just connected to GND through the 10K >resistor). The first channel (4 V) is read OK, but for the next one >I read I get a non-zero value (about $008). Looks like the S & H >capacitor is not completely discharged. > >I've checked the followin: > >- Set RA1 to 4 V instead of RA0. In this case it is RA3 the one > that reads a non-zero value. > >- Replace the 10K resistor with a 1K resistor; in this case I > measure about $004 instead of $008 in the 'next' channel. > > >Does someone have a clue? What's happening here? > >Thanks in advance, >G. > >-- >http://www.piclist.com#nomail Going offline? Don't AutoReply us! >email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu