3 Attachment(s)
Keypad with hardware debounce
I don't want to have PAUSE in my program,and I'd like to avoid using an interrupt for this if at all possible.
18F44K22 @ 64MHz, Port D has ST inputs.
Using this schematic from Mr. E's keypad thread:
Attachment 7534
Along with this debounce schematic from http://robotgestation.com/SensorForce.html :
Attachment 7535
I came up with this for my application:
Attachment 7536
I always used to have input pins pulled LOW, first time scanning them using HIGH as default.
Anything stand out as a magic show waiting to happen?
Robert
Re: Keypad with hardware debounce
Hi Robert
I think the 100K resistor should be a 10K. If you read his calculations in the link you posted he uses a 10K. A 100k will
give you around a 1 second de-bounce, which is very long for a keypad. Or, maybe I missed something?
Re: Keypad with hardware debounce
That's even better 'cause I have a truckload of 10K. Should be able to scope this later to compare with un-debounced on the scope and Saleae.
I'm really wishing for USB scope after fiddling for an hour trying to get that pic.
Had concentrated of finishing up my Charlie-plex thread. Hoping to have time to fix it up into an article.
Re: Keypad with hardware debounce
Hi Robert,
I agree with mark_s, the resistor value in the diagram at http://robotgestation.com/SensorForce.html is incorrect. The 100k resistor with a 10uF cap will calculate to a 1 sec Time Constant (T). To yield a 10ms (T) with a 10uF cap a resistor value of 1k will be needed.
Since you are using ST inputs and reading the DS on for the 18F44K22 the logic High input minimum is .8 VDD. Using the Universal Time Constant charge curve, to reach .8 Vs (VDD) from 0v the time will be 1.6 (T). The maximum logic Low for the ST input is .2 VDD. The Delta of the Low and High is 1.4 (T).
If you use a 10k resistor with a 10uF cap (T) will be 100ms, so 1.4 (T) should work out to 140ms to rise to a minimum logic High on the PIC ST inputs.
Regards