Question

As the title suggests, and since I don't know a more formal name for it, my problem is that when I push a button in a 4X4 membrane keypad and while it's being pushed, it adds too many inputs to the system. It seems a silly question but I don't want any hardware components to get rid of this problem. I mean if I have chance to solve it by using only VHDL coding, I will be very glad. To clarify myself, I don't want any sort of code that accomplishes the job. What I am asking is that I just want a method name to start with. (like debouncing pushbuttons) And by the way, I don't want to mess with the clock since I've already divided the clock to determine which button is being pressed in the keypad. But if it is the only solution, then I'm okay with it.

What I want is simply when the user keeps pushing the button such as 4 in the keypad, it should be seen as one input, but if the user push it again not continually but one at a time, then it should be adding another 4 to the system. Finally, I know the question is very subtle since I didn't provide any code. And as you easily notice, I am new to all this stuff. So, sorry for the inconvenience. Any help will be appreciated, thanks in advance!

Was it helpful?

Solution

enter image description hereThe thing you are experiencing is due to so called bouncing of the key, which is basically very rapid change in the signal level when a key is pressed and released. Since these changes are all recorded, inputs get added in your case.

You will need to include a key debounce method such as the one explained in this link. One could debounce by increasing the sampling interval, but more elegant way is to have a state machine which avoids re-registering of input, once it is registered. This will achieve the desired effect of the key being held pressed and still only one input being registered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top