I've used the '877 A/D with no problems at all. I always use a small filter (series R, C to ground) on the inputs, and make sure that the 5V supply is well filtered and bypassed, and that the layout is such that noise is avoided. In my circuits, if I short the I/P pin to ground, the result of the A/D conversion is zero, as it should be. If I put a known, stable voltage on the I/P, the A/D conversion value is stable. If you are reading a varying voltage on the I/P pin with a DVM, you definitely have something wrong. Larry At 11:08 PM 1/14/2003 -0500, you wrote: >Hello, > >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? > >Thank you, > >Jai > >PS: Just in case, I have my Code below. > >clrf TRISB ;Set all of Port B and D to outputs >clrf TRISD > >movlw 0xff >movwf TRISA > >movlw 0x0E ;Set Justification and set RA0 as the only analog input >movwf ADCON1 > > >bcf STATUS, RP0 ;Switch back to Bank 0 > >movlw 0xC1 ;Select A/D on, Channel 0 and RC Clock >movwf ADCON0 > >movlw 0x00 >movwf PORTB ;initialize the ports to a blank value. >movwf PORTD > >Start1 > > >bsf ADCON0, GO ;Start the A/D. >Loop1 >btfsc ADCON0, GO >goto Loop1 > >;Finished The A/D conversion > >movf ADRESL, 0 ;Move the low byte into Port B (B<7>:B<6>) >movwf PORTB > >movf ADRESH, 0 ;Move the high byte into Port D (D<7>:D<0>) >movwf PORTD > > >goto Start1 ;Start it all over again. > > > > > >---------------------------------------- >This mail sent through www.mywaterloo.ca > >-- >http://www.piclist.com hint: The PICList is archived three different >ways. See http://www.piclist.com/#archives for details. Larry Bradley Orleans (Ottawa), Ontario, CANADA -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body