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

Key de-bouncing in 4x4 matrix....

hi , i am not well in english ,try to understand my language.

here i am using 4x4 matrix keypad ....

problem: key de bouncing problem

requirement: when i press key and i hold it some time. i want to display only one time that key in LCD but it is not displayed one time (so many numbers are printed on lcd)...

check my code


#include <LPC177x_8x.H>
#include "7Seg.h"
#include "lcd.h"

unsigned char keypad (void)
   {
        unsigned char key;
        LPC_GPIO1->CLR|=(c1|c2|c3|c4|r1|r2|r3|r4|r5);


        while(1)
           {
               LPC_GPIO1->CLR|=c1;
               LPC_GPIO1->SET|=(c2|c3|c4);                     // first column = 0

                if((LPC_GPIO1->PIN&r1)==0)
                {
                 Delay_ms(100);
                if((LPC_GPIO1->PIN&r1)==0)
                   {
                        key='0';
                        keypad_delay();
                        return key;
                   }
                 }
            if((LPC_GPIO1->PIN&r2)==0)
                {
                 Delay_ms(100)
         if((LPC_GPIO1->PIN&r2)==0)
                {
                        key='4';
                        keypad_delay();
                        return key;
                }
        }
               if((LPC_GPIO1->PIN&r3)==0)
{
                Delay_ms(100);
                 if((LPC_GPIO1->PIN&r3)==0)
                  {