Thanks Bob, things becoming complicated. it sounds like doable but also becomes complic= ated too. use CNI interrupt as a state machine then change the state as soon as hit a= ny key=A0 after let's say 100 scan disable timer base routine. what if while disablin= g they press another key you are going to have missing number. I do not know I have to t= hink but it's a good idea thanks AA=A0 ________________________________ From: Bob Blick To: Microcontroller discussion list - Public. Sent: Thursday, October 6, 2011 1:24 PM Subject: Re: [PIC]: keypad debounce issue On Thursday, October 06, 2011 10:57 AM, "Andre Abelian"=A0 wrote: > I am reading a keypad that is connected to other board. I am using > PIC24FJ256GB110 > with CCS PICC compiler. I am using CNI interrupt "port on change" and > connetced to all 4 rows. > any time any row goes low it create interrupt but also when it goes high > creates interrupt too. > the problem I am having is that I am getting duplicated key "debounce > issue". Normally=A0 Hi Andre, Normally I just scan the keyboard every 20 to 50 milliseconds. Two reasons why I would use interrupt-on-change: 1) I'm saving power in sleep mode and use it to wake up. 2) I want immediate response to a keypress (fire a weapon?) But I would only use the interrupt to trigger a recurring scan. I would have a recurring timer that would do the actual scans. Only one would be enabled at a time. After a number of scans with no keypress, I would enable the interrupt-on-change and disable the timer-based scanning. Cheerful regards, Bob --=20 http://www.fastmail.fm - A no graphics, no pop-ups email service --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .