Shop OBEX P1 Docs P2 Docs Learn Events
Scan buttons with a busy BS2p — Parallax Forums

Scan buttons with a busy BS2p

ArchiverArchiver Posts: 46,084
edited 2003-08-27 14:24 in General Discussion
I need to check the conditions of 12 different buttons, but my BS2p
is very busy doing other tasks. In the Nuts and Volts #62 a 74165
shift register is used to scan a few buttons. Is this method also
taking care of the problem around "buttons pushed – not detected",
due to over work.

Stein.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-08-25 20:23
    In a message dated 8/25/2003 11:57:39 AM Pacific Daylight Time,
    Stein_Frostad@m... writes:
    I need to check the conditions of 12 different buttons, but my BS2p
    is very busy doing other tasks. In the Nuts and Volts #62 a 74165
    shift register is used to scan a few buttons. Is this method also
    taking care of the problem around "buttons pushed
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-25 21:25
    My stamp is working with some serial transmissions using WAIT.
    I must use pulse buttons.

    I was also thinking about the RS flip flop 7474, but the required
    PCB-space could be too big when I need room for 12. (Have not tried
    it)

    I'm also forgotten how to use the flip flop long ago.
    The clear is obvious. Where should I connect the button in?
    What about preset and Ck?
    What about noise and ripple when I push the button.

    Is there a Nuts and Volts project or other application explaining
    how this is done?

    Stein.

    --- In basicstamps@yahoogroups.com, smartdim@a... wrote:
    > In a message dated 8/25/2003 11:57:39 AM Pacific Daylight Time,
    > Stein_Frostad@m... writes:
    > I need to check the conditions of 12 different buttons, but my
    BS2p
    > is very busy doing other tasks. In the Nuts and Volts #62 a 74165
    > shift register is used to scan a few buttons. Is this method also
    > taking care of the problem around "buttons pushed
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-25 22:22
    Hi Stein

    There are external chips and modules available that implement key
    scanning so that all you have to do is read their results. A couple
    of URLs...

    http://www.solutions-cubed.com/Products/MEMKey/memkey_main.htm

    http://www.elabinc.com/ede1144.htm

    If you have 7 pins available on your Stamp, it is also possible to
    implement scanning of a 3x4 key matrix in software. The trick for
    not missing momentary key presses is to put capacitors as a "dynamic
    memory" at the matrix cross points in parallel with the switches.
    The software has to read the keys and recharge the capacitors. That
    adds to the load for your processor of course, maybe 5 milliseconds
    of processing time per iteration, and a few bytes of RAM for the
    state machine.

    -- Tracy




    >My stamp is working with some serial transmissions using WAIT.
    >I must use pulse buttons.
    >
    >I was also thinking about the RS flip flop 7474, but the required
    >PCB-space could be too big when I need room for 12. (Have not tried
    >it)
    >
    >I'm also forgotten how to use the flip flop long ago.
    >The clear is o


    >bvious. Where should I connect the button in?
    >What about preset and Ck?
    >What about noise and ripple when I push the button.
    >
    >Is there a Nuts and Volts project or other application explaining
    >how this is done?
    >
    >Stein.
    >
    >--- In basicstamps@yahoogroups.com, smartdim@a... wrote:
    >> In a message dated 8/25/2003 11:57:39 AM Pacific Daylight Time,
    >> Stein_Frostad@m... writes:
    >> I need to check the conditions of 12 different buttons, but my
    >BS2p
    >> is very busy doing other tasks. In the Nuts and Volts #62 a 74165
    >> shift register is used to scan a few buttons. Is this method also
    >> taking care of the problem around "buttons pushed
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-26 19:50
    If your BS2p busy doing other tasks, try to find a time frame when it
    is not doing anything. Alternate that task between the others and
    reading the button. If you do it fast enough it looks like it is doing
    so many thing at one time.

    On the hardware try use a decoder/multiplexer like 74154. I had a
    design for scanning 72 keys of MIDI music keyboard and only use three
    connections to the micro controller, up position, down position and
    clock. It also measures the speed of the key pressed for velocity.
    Heavy programming though. I can't share the full schematic because it
    is a commercial design but you can get the idea from there.

    - Johari

    --- In basicstamps@yahoogroups.com, "stein_frostad"
    <Stein_Frostad@m...> wrote:
    > I need to check the conditions of 12 different buttons, but my BS2p
    > is very busy doing other tasks. In the Nuts and Volts #62 a 74165
    > shift register is used to scan a few buttons. Is this method also
    > taking care of the problem around "buttons pushed – not detected",
    > due to over work.
    >
    > Stein.
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-27 14:12
    The nice thing about using the shift registers is they take care of the
    debounce and you get a snapshot in time of the switch states. You can
    then break your program into tasks (called with BRANCH or ON-GOTO/GOSUB)
    to process everything accordingly.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office



    Original Message
    From: stein_frostad [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=yV8UWNjergE7bQG7Ind8zyvM46JNr7Lze7_amXyJaC6wbxtxcJUU7CO_gB1fyRyRLI-AT82WcDYA-h_z0YOlXaE]Stein_Frostad@m...[/url
    Sent: Monday, August 25, 2003 1:52 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Scan buttons with a busy BS2p


    I need to check the conditions of 12 different buttons, but my BS2p
    is very busy doing other tasks. In the Nuts and Volts #62 a 74165
    shift register is used to scan a few buttons. Is this method also
    taking care of the problem around "buttons pushed - not detected",
    due to over work.

    Stein.



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-08-27 14:24
    Stein,
    One chip I like to use to read multiple keys is the MM74C922. It's an
    oldie but a goodie. You can have it scan 16 keys and it has a register
    to remember the key pressed and a data available line will tell you
    when you have activity. It's brother the MM74C923 can handle 20 keys
    and the data sheet shows how to expand even further.


    --- In basicstamps@yahoogroups.com, "stein_frostad"
    <Stein_Frostad@m...> wrote:
    > I need to check the conditions of 12 different buttons, but my BS2p
    > is very busy doing other tasks. In the Nuts and Volts #62 a 74165
    > shift register is used to scan a few buttons. Is this method also
    > taking care of the problem around "buttons pushed ? not detected",
    > due to over work.
    >
    > Stein.
Sign In or Register to comment.