The keyboard here we are interfacing is a matrix keyboard. This keyboard is designed with particular rows and columns. These rows and columns are connected to the microcontroller through the ports of microcontroller 8051. We normally use an 8*8 matrix keyboard. So only two ports of 8051 can be easily connected to the rows and columns of the keyboard. Whenever a key is pressed, a row and a column get shorted through that pressed key and all the other keys are left open. When a key is pressed only a bit in the port goes high. Which indicates microcontroller that the key is pressed. By this high on the bit key in the corresponding column is identified. Once we are sure that one of key in the keyboard is pressed next our aim is to identify that key. To do this we first check for a particular row and then we check the corresponding column on the keyboard.
To check the row of the pressed key in the keyboard, one of the rows is made high by making one of the bits in the output port 8051 high. This is done until the row is found out. Once we get the row next our job is to find out the column of the pressed key. The column is detected by contents in the input ports with the help of a counter. The content of the input port is rotated with carrying until the carry bit is set.
The contents of the counter are then compared and displayed on the display. This display is designed using a seven-segment display and a BCD to seven-segment decoder IC 7447. The BCD equivalent number of the counters sent through the output part of 8051 displays the number of the pressed keys.
SEVEN SEGMENT DISPLAY