Searching \ for 'Keypad Matrix Problem. BITs stay high?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=keypad+matrix+problem
Search entire site for: 'Keypad Matrix Problem. BITs stay high?'.

Truncated match.
PICList Thread
'Keypad Matrix Problem. BITs stay high?'
2000\02\05@185656 by Darren King

flavicon
face
I'm trying to read a Keyboard Matrix that is connected so that I scan 4
input lines and pulse 4 output lines and when I pulse and check I find the
button that is pressed.  I wrote an E-Mail about this before and I thank
everyone for that answer.  Now my problem is when I press a button (Buttons
has a 270Ohm Pull up resistor) the BIT goes high, then when I let go of the
button the BIT stays high.  Then after about a second or 2 it fades off.
This wasn't a good result.

This Buttons do not have an Normal Open Pull down resistor so I guess the
just float when disconnected.  I tried to activate the internal pull ups.
This didn't help.  This just made all the bits high all the time.  I've been
Thinking of Toggling the TRISB state after a read to reset the Pins states,
but there must be an easier way.

Darren King

2000\02\05@202733 by John Mullan

picon face
When you are pulsing your outputs, are you pulsing low??

You need to pulse them low then scan the other lines looking for a low.

John


{Original Message removed}

2000\02\05@211135 by Ken Webster

flavicon
face
Your switches already have a 270 Ohm pullup?

Scan as follows:

                          Vdd
                           |
                           \
                           /  270
                           \
                           /
                  _|_      |
Output ------------- ------------------- Input


Drive the output LOW to test for keys on a given row or column.  You can
tell that a switch is pressed if the input is LOW.  The pullup resistor will
cause the input to quickly return high after the output is turned off or the
switch is released.

Do NOT drive any of the outputs high because they could be shorted to the
output which is driven low if more than one key is pressed in the matrix.
Load the output latch with a "0" for each output bit and leave it that way.
Set the corresponding TRIS bit to "0" to drive a row or column output.  Set
the TRIS bit back to a "1" to stop driving the row or column output.

If you can replace the 270 Ohm resistors with larger values (10k would be
nice) then the circuit would consume less power.  The inputs would still
return high within a microsecond or two unless you have more than a coupple
hundred pF capacitance on them.

Cheers,

Ken

--------------------
Darren King wrote:
{Quote hidden}

been
>Thinking of Toggling the TRISB state after a read to reset the Pins states,
>but there must be an easier way.

2000\02\06@000915 by Darren King

flavicon
face
> Drive the output LOW to test for keys on a given row or column.  You can
> tell that a switch is pressed if the input is LOW.  The pullup resistor
will
> cause the input to quickly return high after the output is turned off or
the
> switch is released.

This is what I did and it seem to fix the problem.  I make the Pins on the
OUTPUT like 0111 1011 1101 1110.  Then when I connect to another Input Pin I
get a result that is LOW only at the time I'm on the scan for that button
and as soon as I release it goes back to HIGH cause if the internal pull
ups.

> Do NOT drive any of the outputs high because they could be shorted to the
> output which is driven low if more than one key is pressed in the matrix.
> Load the output latch with a "0" for each output bit and leave it that
way.
> Set the corresponding TRIS bit to "0" to drive a row or column output.
Set
> the TRIS bit back to a "1" to stop driving the row or column output.

This is what I can't understand?  How will I know which pin is which if I
don't set the other 3 high when I'm checking my inputs.  I realize the
situation if I press 2 keys on the same ROW at the same time I short out the
Outputs.  Is this that bad?  How else could I do it?

> If you can replace the 270 Ohm resistors with larger values (10k would be
> nice) then the circuit would consume less power.  The inputs would still
> return high within a microsecond or two unless you have more than a
coupple
> hundred pF capacitance on them.

Noted for future designs.

Darren King


> Darren King wrote:
> >I'm trying to read a Keyboard Matrix that is connected so that I scan 4
> >input lines and pulse 4 output lines and when I pulse and check I find
the
> >button that is pressed.  I wrote an E-Mail about this before and I thank
> >everyone for that answer.  Now my problem is when I press a button
(Buttons
> >has a 270Ohm Pull up resistor) the BIT goes high, then when I let go of
the
> >button the BIT stays high.  Then after about a second or 2 it fades off.
> >This wasn't a good result.
> >
> >This Buttons do not have an Normal Open Pull down resistor so I guess the
> >just float when disconnected.  I tried to activate the internal pull ups.
> >This didn't help.  This just made all the bits high all the time.  I've
> been
> >Thinking of Toggling the TRISB state after a read to reset the Pins
states,
> >but there must be an easier way.

2000\02\06@070711 by paulb

flavicon
face
Darren King wrote:

>> Do NOT drive any of the outputs high because they could be shorted to
>> the output which is driven low if more than one key is pressed in the
>> matrix.  Load the output latch with a "0" for each output bit and
>> leave it that way.  Set the corresponding TRIS bit to "0" to drive a
>> row or column output.  Set the TRIS bit back to a "1" to stop driving
>> the row or column output.

> This is what I can't understand?  How will I know which pin is which
> if I don't set the other 3 high when I'm checking my inputs.

 Because the pull-ups will pull up any input that is not connected or
is connected to a strobe line that is open-circuit.  That's what the
pull-ups are for.

>  I realize the situation if I press 2 keys on the same ROW at the same
> time I short out the Outputs.  Is this that bad?

 Yes.

>  How else could I do it?

 Simply follow the instructions (above) given each time before by Ken
and myself.
--
 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...