post details Interfacing-Keyboard-8051-Microcontroller | Interface-Matrix-Keyboard-4x4-8051-Microcontrollers | Interface-PC-Keyboard-8051-Micrcocontrollers
Interfacing Matrix Keyboards 8051 Microcontrollers


Interfacing 4x4 Matrix Keyboard 8051 Microcontroller Family Models :
Atmel, NXP, Philips, 8051, 8052, 89C51, 89C52, 89S51, 89s52, 89C1051, 89C1051, 89C2051, AT89C4051, AT89S8252,l AT89C1051, AT89C2051, AT89C4051, P89C51RB+, P89C51RC+, P89C51RD+, P89C51RB2Hxx, P89C51RC2Hxx, P89C51RD2Hxx, P89C660, P89C662, P89C664, P89C668, P89C669, P89C51RA2xx, P89C51RB2xx, P89C51RC2xx, P89C51RD2xx, P89C60X2, P89C61X2,P89LV51RB2, P89LV51RC2, P89LV51RD2, P89V51RB2, P89V51RC2, P89V51RD2, P89V660, P89V662, P89V664.
Introduction Keyboard 8051 Microcontroller
keybaord matrix 4x4 interfacing 8051 microcontrollers
Keyboards and LCDs are the most widely used input/output devices of the 8051, and a basic understanding of them is essential. In this section, we first discuss keyboard fundamentals, along with key press and key detection mechanisms, Then we show how a keyboard is interfaced to an 8051. Interfacing keyboard with 8051 Microcontroller is the most common practice and important part of any embedded systems. Any application which needs data to be accept we attach keyboard to it and input ports of 8051 Microcontroller are connected with this so that the data should be entered easily through pressing keys. In order to interface keyboard with 8051 we need a matrix keyboard. These boards are designed with particular rows and columns. These rows and columns are connected to the microcontroller through its ports of the microcontroller 8051. We normally use 8x8 matrix or 4x4 matrix keyboard are used to connect it to the 8051 Microcontroller. 
How Keyboard Works 8051 Microcontrollers
Matrix keyboard is very compact and easy to interface with CPU only two ports of 8051 can be used to connect the keyboard. When we press any key on the keyboard then only row and column gets activated and other keys are left un pressed. So the switch at keyboard sends the signal to the port of microcontroller that a particular pin has low signal. Which informs the CPU that a particular key is pressed by the user. When the pressed key is identified then application running in the microcontroller execute the instruction what to do in that situation.
How Keyboard Works 8051 Microcontrollers
Scanning Pressed Key 8051 Microcontrollers
In order to detect a pressed key the 8051 microcontroller grounds all rows by providing low signal to the output latch and scans the column. However, if one of the columns bits has a zero, this means that a key press has occurred. After a key press is detected, the microcontroller will go through the process of identifying the key. Starting with the top row, the microcontroller grounds it by providing a low to row D0 only; then it reads the columns. If the data read is all1s, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns, and checks for any zero. This process continues until the row is identified. After identification of the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. This should be easy since the microcontroller knows at any time which row and column are being accessed.