#### AFAS87

Joined Oct 9, 2008
23
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.

#### Attachments

• 107 KB Views: 173

#### retched

Joined Dec 5, 2009
5,208
Search 'debouncing'.
You will find a few good techniques.

#### AlexR

Joined Jan 16, 2008
732
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.

#### jpanhalt

Joined Jan 18, 2008
8,759
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

Joined Oct 9, 2008
23

#### AFAS87

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

#### BMorse

Joined Sep 26, 2009
2,675
No need to search.
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

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

#### BMorse

Joined Sep 26, 2009
2,675
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.

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...

The keyboard encoders connect to a switch matrix that is 4
rows by 4 columns (MM74C922) or 5 rows by 4 columns
(MM74C923). When no keys are depressed, the row inputs
are pulled high by internal pull-ups and the column outputs
sequentially output a logic 0''. These outputs are open
drain and are therefore low for 25% of the time and otherwise
off. The column scan rate is controlled by the oscillator
input, which consists of a Schmitt trigger oscillator, a 2-bit
counter, and a 2±4-bit decoder.
When a key is depressed, key 0, for example, nothing will
happen when the X1 input is off, since Y1 will remain high.
When the X1 column is scanned, X1 goes low and Y1 will go
low. This disables the counter and keeps X1 low. Y1 going
low also initiates the key bounce circuit timing and locks out
the other Y inputs. The key code to be output is a combination
of the frozen counter value and the decoded Y inputs.
Once the key bounce circuit times out, the data is latched,
and the Data Available (DAV) output goes high.
If, during the key closure the switch bounces, Y1 input will
go high again, restarting the scan and resetting the key
bounce circuitry. The key may bounce several times, but as
soon as the switch stays low for a debounce period, the
closure is assumed valid and the data is latched.
A key may also bounce when it is released. To ensure that
the encoder does not recognize this bounce as another key
closure, the debounce circuit must time out before another
closure is recognized.
The two-key roll-over feature can be illustrated by assuming
a key is depressed, and then a second key is depressed.
Since all scanning has stopped, and all other Y inputs are
disabled, the second key is not recognized until the first key
is lifted and the key bounce circuitry has reset.
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