This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with keypad code

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 ++;

                                }
                        }

}

Parents Reply Children