Assembly, not C. Let me know if assembly is fine and I'll email it to you)= .. Cheers, -Neil. Quoting Andre Abelian : > Neil, > > yes CNI same as port on change except any pin has CN name can be used. > pic16,18 are setup on portb only if I am not mistaken. what you =20 > explained sounds > interesting. are you using c?. can I see your code?=A0 > in my case I am not driving the columns. I am only reading target =20 > board that has a keypad > > thanks > > Andre=A0 > > > ________________________________ > From: PICdude > To: piclist@mit.edu > Sent: Thursday, October 6, 2011 7:46 PM > Subject: Re: [PIC]: keypad debounce issue > > What's CNI?=A0 I'm guessing something 24F specific? > > This is how I debounce on 16F and 18F... periodic interrupt reads=A0 > switch state and shifts into a register.=A0 Each time a new value is=A0 > shifted in, I look for patterns -- for an active-low switch, 11111110=A0 > means the switch was just pressed (before any bouncing occurred).=A0 > 00000001 means it was just released (well after all bouncing stops). > > FWIW, rather than act on a switch press, I start a timer.=A0 If the=A0 > switch is released before a specific time, I perform a "click" action.=A0 > =A0 If the timer reaches a specific value before the switch is released,= =A0 > then I perform a "long-click" action.=A0 In a different app, when the=A0 > switch is released I start a timer and if pressed again within a=A0 > certain time, it's a double-click. > > Cheers, > -Neil. > > > > Quoting Andre Abelian : > >> Thanks Bob, >> >> things becoming complicated. it sounds like doable but also becomes=A0 >> complicated too. >> use CNI interrupt as a state machine then change the state as soon=A0 >> as hit any key=A0 >> after let's say 100 scan disable timer base routine. what if while=A0 >> disabling they press >> another key you are going to have missing number. I do not know I=A0 >> have to think >> 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 hig= h >>> 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 >> >> -- >> http://www.fastmail.fm - A no graphics, no pop-ups email service >> >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- > 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 .