Shop OBEX P1 Docs P2 Docs Learn Events
Stamp lags in detecting IN6 being 0 — Parallax Forums

Stamp lags in detecting IN6 being 0

MatthewMatthew Posts: 200
edited 2005-02-16 06:34 in BASIC Stamp
Hello.

I have a 'break wire' trigger system set up on my stamp so that if IN6 = 0, the program will continue.

Pretty much the loop looks like this:

DO
LOOP UNTIL IN6 = 0

I have pin 6 conntect to a 220 resistor, which is connected to a wire, which is then connected to Vdd. Everything starts connected, and supposedly if I remove the wire, IN6 is supposed to = 0. In my case, sometimes it reads it right away, sometimes it takes up to 4 seconds. I know it's not a refreshing issue because I tested this:

DO
counter = counter + 1
DEBUG HOME, DEC5 counter
DEBUG, CR, DEC1 IN6
LOOP UNTIL IN6=0

'Counter' increases it's value very very very very rapidly, yet sometimes it won't detect IN6 being 0 if the wire is broken.

Any ideas?

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2005-02-16 05:50
    Then whatever is in your DO loop is slowing you down.

    You posted some do/loop code...is that what you actually use?· and does THAT too take 4 seconds?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • jasjas Posts: 1
    edited 2005-02-16 06:06
    Remember stamps dont have pull up or pull downs. When you dissconnect the wire the state of the pin is floating. Install a 10K resistor between ground and pin 6.

    To see how a floating pins effect your progect run your program and rub your finger accross the pin. I am sure it will change state.
  • MatthewMatthew Posts: 200
    edited 2005-02-16 06:34
    Jas,

    Thanks a bunch man! It works now. The pull up and downs and floating pins makes lots of sense!

    Matthew
Sign In or Register to comment.