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 ++; } } }
The 74C922 may take care of the de-bounce. But you may need to look for the key to be released. Plus your interrupt should be edge triggered not level triggered. you should most like add a "using" statement to you interrupt.