Shop OBEX P1 Docs P2 Docs Learn Events
Multiple pushbuttons on one pin using adaptive ADC - Page 4 — Parallax Forums

Multiple pushbuttons on one pin using adaptive ADC

124»

Comments

  • cgraceycgracey Posts: 14,206

    @"Beau Schwabe" said:
    Chip,

    Here is some more "alien tech" for you ... I had to step once again into the Wayback machine to my web site where I had posted this for the Basic Stamp .... This thing doesn't even have a micro, just uses a decade counter/divider IC. Whatever frequency you give it translates to the baud in standard 8N1 format

    I can't figure out what that thing does.

  • It's sending using the 10 sequential steps of the 4017 to construct a serial byte, including start bit. So each switch appears as a single bit position in each character byte. Really neat circuit, Beau

  • The 4017 just recirculates a single "one" bit, starting at Q0 (the stop bit, since it's always high). Q1 is the start bit (always low). Q2 -Q9 are the data bits, selected by the switches. Of course, runty data pulses are always a possibility, but it doesn't matter, since every sequence is likely to be repeated several times.

    -Phil

  • @"Beau Schwabe" said:
    Chip,

    Here is some more "alien tech" for you ... I had to step once again into the Wayback machine to my web site where I had posted this for the Basic Stamp .... This thing doesn't even have a micro, just uses a decade counter/divider IC. Whatever frequency you give it translates to the baud in standard 8N1 format

    Wow, I've done something like that to interface a 12bit ADC to a PC over serial in mid-90s - I used a GAL instead, but it was the same principle (I've had GALs laying around). With 8 bits of data, this works great with jellybean logic as you've shown. Cool idea!

  • cgraceycgracey Posts: 14,206
    edited 2021-02-21 10:58

    Here is the latest/final "FIVE buttons on ONE pin" program. It shows you graphically in real-time what buttons you are pushing.

  • cgraceycgracey Posts: 14,206
    edited 2021-03-04 03:48

    I upgraded the "Five_Buttons_One_Pin" program to use a binary tree search for the threshold value that determines the button combination. This makes it take about 1/6th the interrupt time chunk as before. I also added 4-bit-unanimous filtering to each button bit output, so it should be quite impervious to noise. At 60MHz, this filtering gives a button-bit transition time of 2ms.

    Jim Bagley was having problems with the 75-ohm button toggling in his arcade application. We will see if this solves the problem. If he has a noise problem, this should do it. If there's a voltage-sag problem, this won't solve it.

  • cgraceycgracey Posts: 14,206

    Jim Bagley just got this integrated into the ARC8ADE code and it solved the problem. Stable button readings now on all eight RJ-45 ports.

  • ColeyColey Posts: 1,110

    I've just tested it with Cluso's Retroblade board, it's a lot better, thanks Chip!

  • cgraceycgracey Posts: 14,206

    @Coley said:
    I've just tested it with Cluso's Retroblade board, it's a lot better, thanks Chip!

    You're welcome.

    It occurred to me that there's no need to debounce the individual button bits, because they are all part of a single number. I think I just need to pass the number when it has been stable for several samples. That would be faster and less code. I will make another change.

  • cgraceycgracey Posts: 14,206
    edited 2021-03-05 01:05

    Here is the latest "Five_Buttons_One_Pin" program. The debounce code became much smaller/faster, since it's debouncing a single byte value, not five separate bit values.

            mov     a,filter        'if buttons (b) same for five readings, update states_
            rolbyte filter,b,#0
            cmp     a,filter   wz
      if_z  mov     states_,b
    
Sign In or Register to comment.