Hi... I need a C code for Keyboard 5x4 Matrix interfacing with 89C52. I have tried but cant control debouncing. If anyone could help me, I 'll be thank ful.
Do not worry, it's rather simple. The approach can be like this. You read the key states at a certain rate (2 to 5 milliseconds is a reasonable choice) and you compare the actual state with one or several previous states. If it coincides, you take it as "real" key state. If it doesn't, you do not change the "real" state. In my practice good result was obtained with no comparison at all for active state and four consecutive coincidences for passive state. That gives a "soft" key. If you want it to be more tough, you can use 2 and 2. Regards, Michael.