Keyboard matrix problem.

SgtB

Member
Hello!
I've run into a problem with a 4x5 matrix on a 40X2 I've built. I'm pulling the four columns high one at a time and reading the value of each of the five rows into a ptr. My problem is that every button works fine, but if I push two buttons on the same row, the voltage drops from 5v to .8v and turns off everything on that row. What can I do to fix this? I'm a little foggy on where the sink is. Is it because the output isn't strong enough, or is it in how the inputs are on the silicon? Can I use diodes somehow, or would it be better to use sink detection instead with pullups? Is it a simple programming change I can make? Thanks in advance. Here's the relative code snippet.
EDIT: I have a 10k pull down on each input if that makes a difference.

Code:
'Set symbols for button rows and columns
Symbol Col1 = A.0    <These are set high one at a time
Symbol Col2 = A.1
Symbol Col3 = A.2
Symbol Col4 = A.3
'********************
Symbol Row1 = pinA.5   <These are read as inputs one at a time.
Symbol Row2 = pinA.6
Symbol Row3 = pinA.7
Symbol Row4 = pinC.0
Symbol Row5 = pinC.1
'********************

ReadButtons:
'Read the current state of each button into scratchpad byes 1-20. 
'Compare them to previous values in 21-30.
'If they are different determine note on or off, and store cv in pv.

ptr = 1
high col1
 @ptrinc = row1 
 @ptrinc = row2
 @ptrinc = row3
 @ptrinc = row4
 @ptrinc = row5

low col1
high col2
 @ptrinc = row1
 @ptrinc = row2
 @ptrinc = row3
 @ptrinc = row4
 @ptrinc = row5
low col2
high col3
 @ptrinc = row1
 @ptrinc = row2
 @ptrinc = row3
 @ptrinc = row4
 @ptrinc = row5
low col3
high col4
 @ptrinc = row1
 @ptrinc = row2
 @ptrinc = row3
 @ptrinc = row4
 @ptrinc = row5
low col4

-SNIP-
 

Dippy

Moderator
Assuming I have right end of stick...

When you press 2 buttons on same row you are forming an intermittent short circuit between +V and Gnd on the PIC output driver.
Remember, High is PIC Output-on+V and Low is PIC Output-on+Gnd.

I think that if you tri-state the O/P pins instead of just saying Low it'll sort it.

Draw it out and put in the current paths.... I'm trying to do it in my head which is fairly thick.
 

SgtB

Member
Ahhh, so obvious! Thanks. What command would you replace low with? Set it as an input? I may just slap a diode on the top of each column.
 
Top