Interfacing 4x4 Keypad With 8051 Microcontroller
Interfacing 4x4 Keypad With 8051 Microcontroller
Interfacing 4x4 Keypad With 8051 Microcontroller
Microcontroller
10 0 858
Keypad interfacing plays a important role in interrupt processing and modes of giving inputs to the
microcontroller.The above circuit teaches you how to interface a 4 x 4 keypad with the
microcontroller and how the micrcontroller takes input from the keypad.The interfacing of the keypad
with the microcontroller was done by means of a method called Scanning.In this Scanning method
the keys are connected in such a way one end of the keys was connected in rows and another end
was given to column respectively thereby forming 4 x 4 keypad.Each row was connected to each
pins in the port and columns to another port pins respectively.
After connecting the rows and columns to their respective ports as shown in the above circuit
diagram then its time to apply logic to make it work and read input from the Keypad.In order to make
this work we are about to keep a (either row or column) value as constant and change either row or
columns input to observe the change when the keypad is pressed.In simple words we are going to
use one as input and another as output.In the above circuit we are going to
Take rows as inputs and columns as outputs.
Apply logic 1 to all columns in the keypad.
Apply logic 0 to all rows one by one and read the column output.
Say for example if logic 0 was applied to row 1 in the keypad and in that instant if switch "2"
of that row was pressed then the pin P3.5 in which the "2nd" switch was connected
becomes low.
This low signal in that P3.5 pin tells the controller that the switch in the "SW2" was pressed.
By this way every row was scanned infinite times and controller looks for pressed key in the
keypad.
Since the speed of the Microcontroller was very high it scans the whole keypad in fraction of
seconds, so there is no chance of missing a pressed key.The speed of scanning depends on the
frequency of the crystal used in the Microcontroller.We should give the value that a controller should
take when a key is pressed in the program.I have added the LED's in the port 0 in order to illustrate
the working of the switches connected to the microcontroller.That is i have written the program in
such a way that whenever a key was pressed corresponding LED given in the program will lit up.The
LED's was connected in the common anode mode so whenever logic 0 applied to port 0 will make
the LED's to light up.
Now lets move into the Programming the controller for scanning the microcontroller.The program
was written in Embedded C language and the software used was Archimedes IDE 8051.
- See more at: http://www.gadgetronicx.com/2013/08/interfacing-4-x-4-keypad-with-
8051.html#sthash.7w9YiHgK.dpuf