Need 4 modes with just 3 switches - need all modes to be selectable QUICKLY!


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default Need 4 modes with just 3 switches - need all modes to be selectable QUICKLY!

    Hi Guys,

    here's my conundrum.

    I'm knocking up a guitar widget that has four modes - becuase the unit needs to be physcially small, I can only shoehorn 3 momentary switches into it.

    Ok, so at the moment, I've arranged 'user interface' as follows...

    Switch 1 pressed quickly = mode 1
    Switch 2 pressed quickly = mode 2,
    Switch 3 pressed quickly = mode 3, pressed and held for 250ms = mode 4.

    (all switches use interupts - thanks Darrel! )

    ok, no problems....ie I've got four modes out of the three switches - *But*...I don't know if you've ever played a guitar, but in mid Steve Vai-esqe solo (I wish!), that Switch3 200ms press & hold to select mode 4 seems like a lifetime waiting. Also, I reckon that mode 4 won't be actually used that often, but presently when selecting either mode 3 or 4, the program pauses 250ms (to see if the switch has been held down), before deciding whether it's actually mode 3 or mode 4 that's required...this means that mode 3 is held back when selecting too - there has to be a slicker way of doing this!

    So, I'm now thinking about rather a press & hold for mode 4, you press Switch3 twice in quick succession (& bringing a timer into play)

    I was just wondering what the more experienced among you think about the viability of getting the speed of 4 mode selection with 3 switches down to lightning fast levels?
    Last edited by HankMcSpank; - 5th August 2010 at 11:50.

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    I assume the switches are right next to eachother? if so, why not make it so that mode 4 can be activated by pressing 2 and 3 at the same time. To do this i would suggest that for the interrupt handler for switch 3, have a quick loop that checks button 2 for a short time (something like 20ms). If it is pressed, activate mode 4, else activate mode 3.

    The "double click" can be done too, but requires a bit more logic and probably a timer.
    Last edited by Kamikaze47; - 5th August 2010 at 12:01. Reason: changed the idea slightly to fix a flaw
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    I assume the switches are right next to eachother? if so, why not make it so that mode 4 can be activated by pressing 2 and 3 at the same time. To do this i would suggest that for the interrupt handler for switch 3, have a quick loop that checks button 2 for a short time (something like 20ms). If it is pressed, activate mode 4, else activate mode 3.

    The "double click" can be done too, but requires a bit more logic and probably a timer.
    Thanks for your input...I'd pondered that option - and yes the switches are near each other - but I worry a little over the actual logistics. A guitarist will be selecting these switches with his right hand - this will already have a plectrum in it (between the thumb and forefinger), this leave him needing to press two switches concurrently but with two fingers partially out of action - then there's the accuracy at landing fingers on two small (3.5mm diameter) button tops 'on the fly' in mid solo etc on a dimly lit stage etc.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    How about using 1 switch as the mode switch? Use a toggle switch to select how the other 2 switches act.

    Mode switch = 1, other two act as switches 1 & 2. Mode switch = 0, other two act as switches 3 & 4.

    Or use a normally open mode switch. Press once, in mode 1. Press again, in mode 2.

    Kind of like the Shift key on your keyboard that doesn't need to be held down to select other key functions.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Post

    In that case the double press is probably the best option. Something like this:

    button3 interrupt handler:

    IF timer is not running THEN
    set timer so it will overflow after x time (max double click time), and start timer running
    ELSE
    set to mode 4
    stop timer
    ENDIF

    timer interrupt handler:

    set to mode 3
    stop timer
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  6. #6
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Bruce,

    Thanks for the idea - I'm unable to use a toggle switches (though I'd have loved to have), because this PIC/PCB/Switches are going in a small control box with just 5.5mm headroom inside (just under 1/4"" in old money)....also the control box will affixed to the guitar body with four small adhesive pads - a toggle switch would mean the player would be applying force 'sideways' on the switch (with respect to the control box surface), which could place some stress of the adhesive fixings whereas momentary switches, the force will be down (ie pressing the adhesive pads down).

    Kamikaze47,

    i'm not a programmer...& this stuff doesn't come naturally to me....but thanks for the example to get me started, I'll see how I can weave that concept into my code over the next day or two.

  7. #7
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HankMcSpank View Post
    Kamikaze47,

    i'm not a programmer...& this stuff doesn't come naturally to me....but thanks for the example to get me started, I'll see how I can weave that concept into my code over the next day or two.
    Give it a try, and if you get stuck, post the code you have written here and we can help.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts