Keyboard Matrix with a Twist


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Posts
    11


    Did you find this post helpful? Yes | No

    Default A reply i got on another forum which explains the hardware needed

    A conventional keyboard matrix can be drawn as rows and columns of wires, with a switch where each row wire crosses a column wire.
    You scan the matrix by (for example) having pull-up resistors on each of the column wires. You drive one of the row wires low, and see which of the column wires have gone low in response - and you conclude that the switches on the junctions between the driven row and the responding column(s) are closed (i.e. pressed).

    This is fine until you have several switches closed.
    Suppose you have the switches that join row A with column 2, row A with column 3 and row B with column 3 all closed.
    When you pull row B low, column 3 will be pulled down.
    The problem is that this will pull row A low. And this will pull column 2 low so you think you have the switch between row B and column 2 closed as well.
    (Sorry I'm no good at ascii art).

    There is a fix:
    Put a diode in series with each switch.

    Hope this helps.
    - Danish

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


    Did you find this post helpful? Yes | No

    Default

    appart from having an existing zillion of these in stock, could you explain WHY you want to use closed-type switches???

    Sure it's all doable...
    Steve

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

  3. #3
    Join Date
    Oct 2008
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    I'm trying to make my own alarm system.

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Welcome back Steve.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You can solve the problem with a 16 channels mux (74hc4067)

    You connect one input pin of your pic to pin 1 of the mux.

    Ground pin 12 and pin 15 of mux (Enable)

    Connect pin 24 to + 5V

    Connect Pins 10; 11; 13 and 14 to 4 output pins of your pic.

    Pullup all 16 mux inputs with a 10k resistor

    Ground all 16 mux input with n.o. switches

    Write a code to scan the mux. Read input pin. If pin=0 then switch is close.
    If pin=1 then switch is open.
    Scan position will tell you wich swicth has been activated.

    Al.

  6. #6
    Join Date
    Oct 2008
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    You can solve the problem with a 16 channels mux (74hc4067)

    Ground all 16 mux input with n.o. switches

    Al.
    Can this be used with normally closed switches?

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Yes I made the mistake to write n.o. intending n.c. Sorry for that!

    Al.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by k3v1nP View Post
    Can this be used with normally closed switches?
    What's up with the switches?
    Are they what you have on hand and want to use them up?
    Are you short of pins on your present project, yet still need to hook up the switches?
    Just trying to get a feel for a good solution. The '4067 isn't a bad solution, for an N.O. switch. But I'm thinking, if you're going to go that route, may as well whip up another PIC to do the tough work for you...

Similar Threads

  1. 10x4 matrix keyboard using only portB
    By aratti in forum Code Examples
    Replies: 19
    Last Post: - 16th November 2011, 10:39
  2. AT/PS2 Keybord - PIC Interface?
    By Kamikaze47 in forum Code Examples
    Replies: 73
    Last Post: - 9th August 2009, 17:10
  3. reading and conecting 10x6 matrix keyboard
    By ustredna in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 9th August 2006, 04:04
  4. LCD + keyboard matrix minimal I/O
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st June 2006, 20:49
  5. Matrix keyboard problem
    By MegaADY in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th May 2005, 19:50

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