Got another problem here...
i am using 74c922 ic together with the keypad and i am using external interrupt for the keypad code.
i want to store four different numbers into an array. when i press a key on the keypad, it capture the key that i pressed and store that key in the array.
the problem is that it capture the same key four times when i only press the key only one time.
could anyone help me on this?
Below is my code:
void keypad_interrupt (void) interrupt 0 { Key =((P2 & 0xF0)>>4); IntValue = key_table[Key]; if((IntValue == 0x23)||(IntValue == 0x2A)) { Init_Password(); PasswordValid = FALSE; PasswordBuffer = 0; return; } if (PasswordValid == TRUE) { } else { if(PasswordBuffer < 4) { Password[PasswordBuffer] = IntValue; PasswordBuffer ++; } } }
It is a fundamental property of all mechanical switches!
Any textbook covering basic interfacing should cover it, and an internet search for "switch bounce" or "debounce" will provide plenty to go on...
Thanks everyone! I have solve the problem