(Basics)
(Working)
Line 15: Line 15:
  
 
}}
 
}}
 +
='''Schematic:'''=
 +
Figure below shows the schematic of a keypad interfaced with 8051 micrcontroller. We have tested it with P89V51RD2, you may wish to try in on any other 8051 family MCUs.
 
{{#widget:Iframe
 
{{#widget:Iframe
  
Line 26: Line 28:
  
 
}}
 
}}
 +
='''Code'''=

Revision as of 19:16, 26 March 2014

Basics


The keypad matrix or hex keypad comprising of 16 keys arranged as 4x4 matrix is one of the common interfaces done to a micrcontroller. These are similar to a telephone keypad that we normally come across. In this tutorial we will see about interfacing this keypad to 8051. We will write the code to scan the keys and display the pressed key on the LCD.

Working


For us human beings it takes a few seconds to press a key, but the controller can read the port pin and eventually the keypressed in milliseconds. Hence it is possible to scan a four or more rows and columns while the key is being pressed! In fact, when we will test the code we will realize that a single key press is detected multiple times.

  • KeyBounce: Multiple keypress is also resulted out of mechanical construction of the keys. When we press and release a key, it not just presses once but debounces several times.

There are various ways to eliminate debounce, however we will use time delay to neglect the effect of keybounce.

Schematic:

Figure below shows the schematic of a keypad interfaced with 8051 micrcontroller. We have tested it with P89V51RD2, you may wish to try in on any other 8051 family MCUs. {{#widget:Iframe

|url=http://xplorelabz.com/wiki/images/c/cc/Keypad_8051.pdf

|width=700

|height=400

|border=5

}}

Code