Interupts - can two switches share the 'INT' Pin?


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default Interupts - can two switches share the 'INT' Pin?

    I have two switches that I'd like to use an interupt with....just wondering in my naive n00b world, if it's possible to have both switches connect to & ultimately trigger the INT interupt (pin RA2 on my 16f690) & then in the interupt handle part actually then work out which of the two buttons was pressed by way of also connecting each of these switch to a dedicated unique 16f690 input pin.

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    HankMcSpank, Why yes you can by using a couple of diodes and a pullup or pulldown reststor, depending on the switching state of the switches. If the switches are connecting VDD when made, place the anode of each diode to the appropriate switch and the cathodes of both diodes to the interrupt pin along with a pulldown resistor, When ether of the switches is pressed the interrupt pin will be set high and inside of the interrupt routine you can read which switch is connected to VDD.....

    Dave Purola,
    N8NTA

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    They say a picture is worth a thousand words, so to save me typing, I tried to knock up a quick Eagle irepresentation - do you mean something like this (or have I misinterpreted you?)...

    Last edited by HankMcSpank; - 17th May 2010 at 14:09.

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    HankMcSpank , Exactly...

    Dave Purola,
    N8NTA

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    HankMcSpank, I spoke too quickly.... The pin used for the interrupt should have the cathodes of the two diodes connected to it with a pulldown ONLY... The other two anodes should be connected to each of the resistors and individually connected connected to the port pins to be read as well as the push buttons..

    Dave Purola,
    N8NTA
    Last edited by Dave; - 17th May 2010 at 17:24. Reason: Bad spelling....

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


    Did you find this post helpful? Yes | No

    Default

    Here's one example with 13 switches using just 2 interrupt input pins.
    Attached Images Attached Images
    Regards,

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

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Thanks guys - I have my two switches working sweet onto the one INT pin now (once I figured out that OPTION_REG.6 = 1 wasn't set that is !)

    http://www.darreltaylor.com/DT_INTS-14/hello.html

    On that above URL, I see Darrel is using a cap to debounce the switches - going that route is there any win over & above using a short pause in the interupt handling routine (200ms seems to be debouncing fine & it save me a couple of caps - I'm not a tightwad, but space is going to be limited on my pcb!)

Members who have read this thread : 1

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