Han Giap WROTE: but i still confuse... when should i write the input for increment?
ADCON0=(ADCON0&0xC7)|(channel<<3); //select analog input channel
wat do this coding means?
If you want to do increments position, you do not need to use read_a2d() function any more. just write position=position+1 or position++
Don't bother with ADCON0=(ADCON0&0xC7)|(channel<<3); it's just to set analog input channel on address ADCON0.
Han Giap WROTE:is it almost the same concept with this 1?
http://www.newcircuits.com/circuit.php?id=uct001
Yes, it almost same. Servo just connect directly; 5V, GND and signal.
Push button, you can do pull-up resistor or pull-down resistor.