keypad encoder interfacing

Discussion in 'Embedded Systems and Microcontrollers' started by AFAS87, Feb 15, 2010.

  1. AFAS87

    Thread Starter Member

    Oct 9, 2008
    23
    0
    am interfacing a 4x3 matrix keypad with a PIC through the keypad encoder MM74C922. The problem I have is that some keys, when pressed multiple times, would give me different values, and there also seems to be a bouncing issue. I have put a 10uF capacitor across the osc pin and 100uF capacitor across the keybounce mask pin on the encoder. I have no idea why this is happening.

    thank you.
    attached the schematic.
     
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Search 'debouncing'.
    You will find a few good techniques.
     
    AFAS87 likes this.
  3. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    54
    Looking at the data sheet, your Cosc seems way too high. The sheet show a graph with Cocs ranging from .01uF to 2uF. Your symptoms could be caused by too slow a scan rate. With your present values the scan rate is going to be about 10 scans a second (that's if it works at all) and the debounce mask will be about 1 second. That is going to be a very tacky and unresponsive keypad.

    Try it with Cosc set to 1uF and Cmsk to 10uF and see if it makes it better.
     
    AFAS87 likes this.
  4. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,687
    900
    No need to search. Here is the best reference on debouncing: http://www.ganssle.com/debouncing.pdf

    Probably the easiest way to debounce with an MCU is to write it in code. You know, a check status, delay, check again routine.

    John
     
    AFAS87 likes this.
  5. AFAS87

    Thread Starter Member

    Oct 9, 2008
    23
    0
    thank you for your replies.... i will try your suggestions
     
  6. AFAS87

    Thread Starter Member

    Oct 9, 2008
    23
    0
    i tried with Cosc =1 uf and Cmask = 10 u,,,, but no differennce
    ??
     
  7. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    No need for external debouncing circuit on switch matrix, IC already has it built in.... it needs to be set with an external capacitor.....
     
    AFAS87 likes this.
  8. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    For one, you only have a 12 switch matrix connected to an IC that supports 16 to 20 switches with one switch column tied low, that column will always show as shorted to ground, without any row keys present to scan for..... for 2, why did you choose this IC??? It seems like it has issues with debouncing anyway even with the built in debounce circuit...

    Why not use 7 pins on the uc (it is just 2 more than what you are using now...) and scan the row /columns yourself?? it seems easier to implement than with the decoder IC you are using.....

    My .02
     
    AFAS87 likes this.
  9. AFAS87

    Thread Starter Member

    Oct 9, 2008
    23
    0
    thank you... i work with your advice and it worked will
    i attached a pullup resistors to the colom and row pins
     
Loading...