Dipswitch matrix


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382

    Default Dipswitch matrix

    A project I'm working on uses a 9 position dip switch to set the starting address. Normally I would dedicate 9 I/0 pins to it but I only have 7 available. I thought maybe I could create a 3x3 matrix and read it like a keypad. My only concern is unlike a keypad multiple switches may be on at one time. Am I over thinking this? Will this method work? Is there a better way?
    Last edited by DynamoBen; - 7th October 2007 at 23:29.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    Connect the dip switch to a 74165 type shift register and stream the bits in via 3 lines.

    Jerson

  3. #3
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    While that’s a great idea, and one I had considered, I don't have any lying around. Makes you wish Radio Shack still carried electronic parts.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You could set this up as a voltage divider network and us the ADC to read the voltage.

    By the time you work it all out though I bet you could have the shift register shipped to you
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Getting one shipped isn't the issue its the huge shipping charges. I could order a sample but it would be weeks before I see it.

    BTW this is a 9 position dipswitch not 8.
    Last edited by DynamoBen; - 8th October 2007 at 02:36.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This is not the same one Jerson recommended but should work.
    http://www.allelectronics.com/cgi-bi...REGISTER_.html

    $7.00 shipping ground no matter the size of order.

    BTW this is a 9 position dipswitch not 8.
    You said you have seven pins...register takes 8 inputs and uses three on the PIC. Now you have four left. Use one for the left over switch, now you have three pins left.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Sigh, let me make this more clear.

    I'm not interested in ordering one part and paying $7 shipping. I'm trying to make this work with what I have because I'm under a very short timeline. If the switch matrix idea won't work then I will move onto my backup plan which will be hard programming the ID for now and dealing with the dipswitches later.

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    GOT IT

    My only concern is unlike a keypad multiple switches may be on at one time.
    Try the ADC voltage divider. Even it all of the switches are on it will not matter.

    Have the calculated values far enough apart that temperature variations will not cause an overlap and code for a plus or minus reading.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    After digging around in my desk at work I have located a 74LS165, which should do the job.

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    i second the Voltage divider option too. Look at the Microchip appnote bellow

    http://ww1.microchip.com/downloads/e...Doc/40040C.pdf

    See tip #5... At least if you don't use that method, keep this document handy. There's a lot of interesting tricks in it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Perfect, thanks I will file this this all my "good to have" docs. Hardest part is remembering that they are there.

Similar Threads

  1. led matrix pic 16f84 and 4017 help me please
    By Mus.me in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 5th February 2011, 00:06
  2. LED Matrix Question
    By mekohler in forum Schematics
    Replies: 28
    Last Post: - 29th September 2007, 13:12
  3. DipSwitch
    By savnik in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 5th September 2006, 08:58
  4. 4x16 Dot Matrix LCD control is possible?
    By muskut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st September 2005, 09:56
  5. need help with switch matrix
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th January 2005, 18:59

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