> Have a question about the A/D on the 16f877. I gave my first shot on coding a > simple converter that uses a divider from a pot as an input to one of the > pins. Now I'm pretty sure I have my code set right, because when I read the > results (I did about 5 test cases), they all seem pretty accurate, except with > a few problems. > > Some of the pins had constantly a constantly changing voltage that was > registering on my DMM. Most of the pins would be stable, either ~0 or 5.2V, > but some of them, each on different tests, would be fluctuating, sometimes > from 2.5-2.9V, and sometimes other values. Is this normal? Does the fact that > my program keeps going in a loop affect this (even though I'm reading the Go/! > Done flag to check when it's done)? And it seems to be different pins each > time, so there doesn't appear to be a definite pattern. On some readings, all > the pins are perfect. Any ideas? This depends on your external circuit. How are the pins being driven? If they are floating, then you could get the symptom you describe. Microchip specifies the source impedence driving an A/D pin should not exceed 10Kohms. Note that as the A/D is switched between channels, you actually have a charge pump from one channel to the next. A newly selected channel is connected to the same internal capacitor that the previous channel was connected to. This actually creates an equivalent resistance from the previous channel voltage to the current channel pin. This equivalent resistance is proportional to the period between selections of the same channel. None of this should matter, however, if each channel's source impedence is 10Kohms or less and you are waiting the proper acquisition time. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body