Professional Documents
Culture Documents
UC Interface
UC Interface
Keyboard
Keyboards are used for interfacing i.e., giving data and
control commands to the microcontroller-based system
The keys are usually pushbutton switches
When this pushbutton key is pressed or released, the
metal contact momentarily bounces (vibrates) before
making steady contact
To eliminate this problem, key debouncing technique
either using hardware or using software is used
(preferably software due to low cost)
In the software technique, when a key press is found, the
VCC
processor waits for at least 10 ms before it accepts the key as
an input
Based upon the way keys are connected, there are two
configurations of keyboards:
simple keyboards (one dimensional): connected directly to I/O
pins
Simple
matrix keyboards (two-dimensional): placed in the matrix with keyboard
rows and columns
Matrix Keyboard
To save the number of port pins, the keys are
arranged in a matrix form Vcc
Number of port pins occupied to interface N M 4.7 k
keys is only N + M instead of N M
Figure beside shows 16 keys arranged in a 4 4 3 2 1 0
4.7 k
matrix of four rows and four columns D0
The rows are connected to an output port and the 7 6 5 4
columns are connected to an input port D1
B A 9 8
If no key has been pressed, reading the input port
D2
will yield 1s for all columns since they are all F E D C
connected to high (VCC)
D3
If all the rows are grounded and a key is pressed,
Port 1
one of the columns will have 0 since the key (Out)
pressed provides the path to ground D3 D2 D1 D0
Port 2
It is the function of the microcontroller to scan the (In)
keyboard continuously to detect and identify the
key pressed
Dr. Santosh Kumar Singh | GP Kuru Pindra Varanasi / Ghazipur Microcontroller | 80
Interfacing
Seven-segment Display
A seven-segment display consist of a group of seven LEDs
(rectangular) to display the decimal (or hexadecimal) numbers
They also have a LED for dot point (decimal point), therefore, contain eight
LEDs in a module designated as a/A to h/H/DP
Seven-segment Display
Figure beside shows interfacing of four seven-
segment modules with the 8051
Four port pins of the uC are connected as an
input to the 7448 segment driver and its output
are connected to all 4 seven-segment modules in
parallel
IC7448 is a BCD to seven-segment code converter or
segment driver to provides required drive current BCD to seven segment codes
Segments
Another set of four port pins of the uC acts as Digit
h g f e d c b a
HEX Code