Dave, Try putting a pull down resistor (100K) from the pin to ground, or across the LED, as the I/P is floating - worse, the LED may be generating a (very very tiny) current from light. (I believe it can happen) I use the inverse (LED to vcc, push button low) of your circuit (with the extra resistor) on my graphic LCD checker:- http://ourworld.compuserve.com/homepages/steve_lawther/t6963tst.gif with no problems. hope it helps, Steve Lawther > -----Original Message----- > From: Dave & Ann Scott [SMTP:andscott@LOGANTELE.COM] > Sent: Friday, August 13, 1999 6:37 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: False HI on Pin, Trying to use pin for both input & output > > I'm trying to use one I/O for both input and output (RA1 on a 16C84). > > Software - Every 8sec or so the pin is changed to an output and set high > to > drive an LED for about 200msec....then turned off and changed back to an > input. Between the LED blinks I poll the input to check whether it's HI. > To debounce, the input must be HI once and again 20msec later. I've got > the weak pull-ups disabled. > > Hardware - The pin has a 470 ohm resistor and (Smurf-) blue LED to ground. > Also a pushbutton switch and 10k resistor to V+. > > What should happen: > If pushbutton not pressed - LED should just blink every 8 sec. > If pushbutton is pressed - start other routine. > > What does happen: Other routine starts by itself. Even if 10k resistor > is > pulled out of the circuit and circuit left open (so pushbutton is not > malfunctioning). > > I added a 1s delay between turning off the LED and reading the input and > problem still occurs. (90% sure the delay is working properly.) > > If I ground the pin, the error does not occur (and LED does not blink). > > There is a 20msec delay between turning off the LED and reading the pin. > Between LED blinks, the pin is read every 20 msec. It appears that a LED > blink is not necessary to make the error occur. > > It's intermittent. :) At other times the other routine functions > correctly when the pushbutton is pressed. > > If relevant, I'm working on a breadboard. > > Can anyone tell me I'm doing wrong? I suspect it's something simple but I > haven't been able to figure it out. > > Dave Scott > > -------------------- DISCLAIMER This email and any attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of WPI Husky Technology. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this mail is strictly prohibited.