On 7/23/05, Augusto Yipmantin wrote: > Hi all, > > I have a circuit that I want to use with a pic16f877a. Two 5K > potentiometers are connected to the pins AN0 and AN1. The program that I > am using reads each pin and shows the value of each pin in an LCD. > What I can see is a little variation after the value is readed, usually > the potentiometer stills in the same position most time. > But, the LCD shows me values one to two up or one to two down from the > center value readed. > It is possible to change something to get a more stable readout? > Maybe I have to use a more precise potentiometer? Not the potmeter is the problem but how much noise there is on the supply voltage. I'm expecting you've wired the potentiometer as a divizor with the center pin (wiper) to the analogic imputs. Check out the noise on the VCC using a scope or a DMM with high resolution and see how many readouts can you see on the last digit (which is moving around a center value up and down). With a scope will be better, but doubts you have one. Filter the reference voltage in the potentiometer input using an RC with a time delay of 10-100mS. A 47nF to 100nF on the analogic pins to ground, may help too but decrease the time response of the circuit. Wrong wired grounds also alter the results on AD. To small Tad (aquisition time) or messy readings on bank1 could gave you the same situation. dig on, Vasile -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist