Maker Pro
Maker Pro

Keypad with latched switches

Hi,

i am using the 8051 and am having trouble with scanning a 2x8 keypad. This is due to the fact that the switches are latched ones (push to make switch). Also more than one switch can be pressed at one time.

The code written, scans each column (the column which is being scanned is set to low) and when a switch is pressed, the output pin is set to low when the column is scanned. The problem arises when more than one switch is pressed in each column. I think this is because when more than one switch is pressed, both the input and the output pins are then set to low due to the two (or more) columns being shorted together. If anyone can help, it would be greatly appreciated. Thank you

Code:

#define Rows P1
#define Columns P2
#define DigitalOP P3

void main(void)
{
while(1)
{
Columns=0xFE;
BPMDelay(1000);
Columns=0xFD;
BPMDelay(1000);
Columns=0xFB;
BPMDelay(1000);
Columns=0xF7;
BPMDelay(1000);
}
}
 

Attachments

  • 111.JPG
    111.JPG
    47.7 KB · Views: 184
Hi,

i am using the 8051 and am having trouble with scanning a 2x8 keypad. This is due to the fact that the switches are latched ones (push to make switch). Also more than one switch can be pressed at one time.

The code written, scans each column (the column which is being scanned is set to low) and when a switch is pressed, the output pin is set to low when the column is scanned. The problem arises when more than one switch is pressed in each column. I think this is because when more than one switch is pressed, both the input and the output pins are then set to low due to the two (or more) columns being shorted together. If anyone can help, it would be greatly appreciated. Thank you
I think you are correct and must implement a multi- or n-key rollover. This may mean simply putting diodes in your switch matrix to isolate each key as it is scanned. Check the simple article at the link below and ask if it needs more explanation.
http://en.wikipedia.org/wiki/Rollover_(key
)
 
Top