One analog Pin - fed from 5 way joystick tactile switch - with interrupt?


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default One analog Pin - fed from 5 way joystick tactile switch - with interrupt?

    The net abounds with circuits showing how to connect a 5 way tactile switch using a potential divider (resistor ladder) to a PIC/Arduino etc .....good stuff.

    To give you a general vibe of the sort of switch I seek, it's gonna be something like this...

    http://www.sparkfun.com/products/10063

    But what I (think) I need is a way of generating an interrupt for such a joystick type switch....so that when any one of thos axises are pressed, I get an interrupt - but I can't see how that can be achieved with only one switch pole 'per axis'? So I seek a space saving 5-way joystick type switch, but with one pole always closing (to generate an interrupt)...the other pole to interface with the potential divider (feeding an analogue pin)

    Or am I missing something....how do others use such 5-way tactile switches? (are they not meant to be used with interrupts?).

    Anyone know of a suitable metod &/or switch?

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Hi Hank, not sure why you can't just poll the A/D, but heres an idea. If your chip has compare on the same pin(s) as A/D (like '877) set the comparater up to interupt when any switch is pressed. then switch to A/D on that pin and read the value. after switch back to comp and wait.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cncmachineguy View Post
    Hi Hank, not sure why you can't just poll the A/D, but heres an idea. If your chip has compare on the same pin(s) as A/D (like '877) set the comparater up to interupt when any switch is pressed. then switch to A/D on that pin and read the value. after switch back to comp and wait.

    Re using a comparator - that's a mighty fine idea.

    re polling ......not sure I've totally understood what you're getting at (I'm still a n00b at heart!), do you mean constantly poll the analogue pin connected to the nav switch to see if there's been a meaningful change in voltage? (thereby meaning a switch has been pressed) If so, my program already has a good few loops with 'pause' commands gratuitously used throughout.

    I guess during the waiting periods (ie pauses), I could be checking the incoming switch potential divider level to check for a change in voltage ....maybe it's my poor programming approach, but I've always has snappier results with interrupts (vs polling)

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