Shop OBEX P1 Docs P2 Docs Learn Events
Latched inputs? — Parallax Forums

Latched inputs?

Have we done this already? Would be nice to have a latched mode for easy debounce. (Saw something on Hack a Day and remembered this nice mode available on some PIA chips I've worked with in the past. Program sets the latch, and user input changes it. Once changed, it stays changed, until the program sets the latch again.

Comments

  • jmgjmg Posts: 15,175
    The Count and capture modes would support this, I would expect.
    ie Pin edges to a change in flags or register values, is naturally 'sticky'.
  • cgraceycgracey Posts: 14,209
    You could set a pin for positive feedback with resistive or current output. It would latch.
  • evanhevanh Posts: 16,041
    What would this be used for? Sounds less of a debounce and more of a low-power circuit.
  • Cool. If that works with a simple button, I will give it a go when it makes sense.

    My old Atari offered that option on its bi-directional game ports. At a little south of 2mhz, it was nice to not worry about polling and or some ISR to manage inputs. If it happened, the state change was there, no worries on CPU intensive code.

    Figured we are making the pins do lots of cool stuff, why not?
  • jmgjmg Posts: 15,175
    cgracey wrote: »
    You could set a pin for positive feedback with resistive or current output. It would latch.
    No need for any external pullups :)
    - or you could use a SPCO micro switch, combined with such a pin-keeper feedback, for debounce.

    A downside is you need to wait for the user to release, before you can re-arm, and that means a regular retry.
    So debounce is not eliminated, just moved from leading edge, to trailing edge.

    For some designs, the leading edge is more important.

Sign In or Register to comment.