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);
}
}
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);
}
}