Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21592 Discussions

time duration for every key in keyboard

Altera_Forum
Honored Contributor II
1,507 Views

hi i want a vhdl code to compute the time duration for every keystroke in the keyboard take to pressed or released .any help plz

0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
594 Views

Do you mean a standard PS2 keyboard, as used for a computer? Or do you mean a keypad with discrete buttons? 

 

A standard keyboard uses a serial protocol. So, every key press and release results in a code being sent - all of which will take the same amount of time, every time. This is 11 bits for every key stroke, at a baud rate anywhere from 10kHz to 16kHz. 

 

If you mean a keypad, then you really need an oscilloscope to allow you to look at the raw signal, complete with key press 'bounce' noise, to determine how long it takes to settle. 

 

You can't really do this with rtl. Yes, you could start a counter (to time the key stroke) when you first detect an edge. You could stop the counter when you received 'a few' clock cycles at the final steady state. However, you're not going to detect the key bounce. So, I'd anticipate you ending up measuring x clock cycles that will, probably, be the same each time - and not at all accurate. 

 

Regards, 

Alex
0 Kudos
Reply