Hi there, I am having this strange problem, hope someone can help me to understand...I have no hair left on my head :( Basically, one of the port lines are set as output and low at the beginning and later it is switched to an input...Circuit works for a while then it gets stuck as output...Resetting and turning off the power does not change the situation...If I reprogram the PIC problem goes away...I don't understand how that happens... More detail: 0.1 microF cap is connected to A2 and ground, 1k to 25k resistor is connected to A2 to +5V. A2 is initially output and and it is set low which discharges the capacitor... Then it is set as an input and capacitor is charged through R... I continously check the A2 if it is high...and I count the time passed... >From that I can determine the value of the resistor... I need to do this once at the start up... So I set the resistor (trimpot) to some value and turn the power on...I read something within 10% of what I expect...Change the resistor value...push the reset button...I read fine again...I repeat this several times... everything seems fine... As I try again and again suddenly it stops reading the correct value!!! A2 gets stuck as output and low... Resetting, turning off the power does not help...However if I reprogram the chip it starts to work again... I switch banks to set porta as input and output... for example, I use this segment to switch portA bit 2 to an input... bsf status, rp0 bsf trisa, 2 bcf status, rp0 Any clue is appreciated...Thank you very much for reading so far! Meric diehardee@usa.net ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1