Searching \ for 'False HI on Pin, Trying to use pin for both input' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/ios.htm?key=input
Search entire site for: 'False HI on Pin, Trying to use pin for both input'.

No exact or substring matches. trying for part
PICList Thread
'False HI on Pin, Trying to use pin for both input '
1999\08\13@133755 by Dave & Ann Scott

flavicon
face
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

1999\08\13@134157 by Gordon Varney

flavicon
face
Dave,
   Did you switch banks for each time you changed from in to out.

Gordon




----- Original Message -----
From: Dave & Ann Scott <spam_OUTandscottTakeThisOuTspamLOGANTELE.COM>
To: <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU>
Sent: Friday, August 13, 1999 12:37 PM
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
{Quote hidden}

is
{Quote hidden}

1999\08\13@140058 by Steve Lawther

flavicon
face
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 removed}

1999\08\13@141118 by Dave & Ann Scott

flavicon
face
Yep.  Here's turning off the LED:

  bcf PORTA, 1
  bsf STATUS, RP0
    movlw 0x00E                ; 0E=0000 1110
                               ; RA0 is an output
                               ; RA1, 2 & 3 are inputs
    movwf TRISA & 0x07F
  bcf STATUS, RP0

----------
{Quote hidden}

1999\08\13@233759 by Dave & Ann Scott

flavicon
face
Problem solved....    :)     (I hope.)

> Steve Lawther replied:
> 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've only done a few quick tests but it appears to solve it.  With the
additional resistor it works correctly.  Without it, I can trigger it with
a flashlight!  Also, never noticed the problem occurring during the night -
always during the day.

> I use the inverse (LED to vcc, push button low) of your circuit (with
> the extra resistor) on my graphic LCD checker:-

Is there any particular advantage to either arrangement?

Thanks.....Dave Scott

1999\08\16@070934 by Caisson

flavicon
face
> Van: Dave & Ann Scott <EraseMEandscottspam_OUTspamTakeThisOuTLOGANTELE.COM>
> Aan: PICLISTspamspam_OUTMITVMA.MIT.EDU
> Onderwerp: False HI on Pin, Trying to use pin for both input & output
> Datum: vrijdag 13 augustus 1999 19:37
>
> I'm trying to use one I/O for both input and output (RA1 on a 16C84).

<Snip>

> 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).

Hello Dave,

 You are testing the the I/O while the LED is Off.  This means that the
I/O line is floating (or rather High, due to the Chip-design).  Reason ?
Think of a LED as a Zener-diode.  If it's ON, current flows.  If it's OFF
allmost _NO_ current flows (leakage only !), so it can't be used as a
pull-down.   Solution :  Put a resistor parallel to the LED.

How come I know this ?  Simple:  I stepped in the same pit-fall you did :-)

Greetz,
 Rudy Wieser

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...