We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all, I am using P89LV51 controller for interfacing LCD and keyboard. The LCD is directly interfaced while keyboard is interfaced through priority encoder. The LCD and keyboard routines are working fine saparately. But when I am getting input from keyboard, converting it to ascii value and trying to display on LCD, the value it displays is incorrect, and it increments the display by 2 or 3 instead of 1. How should I correct this problem?
You should google for "debounce keyboard" and update your code so that it correctly handles the keyboard.
Right now, your code detects multiple key presses for every "real" keypress.
Hi Mr. Per Westermark I am already using debounsing from some references on web and when i am reading the keys in controller and sending it through RS232, the hyper terminal is showing correct values without mutiple keys shows only one key for one press, but while the problem with LCD display is i am getting wrong value and sometimes right value with 2 or 3 increment in lcd cursor position.
Debounce is a question of speed. With slow sampling rate (such as doing serial communication), you may have a broken debounce logic but not see it.
When you call your keyboard read function at a higher frequency, you may start seeing the bounces.
Add a counter in your code that counts number of key presses. Press a known number of times and then check if the counter stepped the same number of times. If the counter did not step exactly as many times as you pressed, then your debounce is broken.