100% found this document useful (1 vote)
529 views15 pages

Keyboard & Seven Segment Display

The document summarizes interfacing a keyboard and seven segment display with an 8051 microcontroller. It describes how keyboards are organized in a matrix and how the microcontroller scans rows and columns to detect key presses. It then explains the process of identifying the pressed key by grounding rows one at a time and reading the columns. Finally, it provides details on seven segment displays including common cathode and common anode types and the hexadecimal values used to display numbers.

Uploaded by

anirudh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
529 views15 pages

Keyboard & Seven Segment Display

The document summarizes interfacing a keyboard and seven segment display with an 8051 microcontroller. It describes how keyboards are organized in a matrix and how the microcontroller scans rows and columns to detect key presses. It then explains the process of identifying the pressed key by grounding rows one at a time and reading the columns. Finally, it provides details on seven segment displays including common cathode and common anode types and the hexadecimal values used to display numbers.

Uploaded by

anirudh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Keyboard & Seven Segment Display Interfacing with 8051 µC

Keyboard Interfacing:
• Keyboards are organized in a matrix of rows and columns
• The CPU accesses both rows and columns through ports
• When a key is pressed, a row and a column make a contact,
Otherwise, there is no connection between rows and columns
Scanning and Identifying the Key:
• It is the function of the microcontroller to scan the keyboard
continuously to detect and identify the key pressed
• To detect a pressed key, the microcontroller grounds all rows by
providing 0 to the output latch, then it reads the columns
• If the data read from columns is D3 – D0 =1111, no key has been
pressed and the process continues till key press is detected
• If one of the column bits has a zero, this means that a key press has
occurred
• For example, if D3 – D0 = 1101, this means that a key in the D1 column
has been pressed
• After detecting a key press, 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
 It reads the columns, if the data read is all 1s, 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
 Find out which column the pressed key belongs to
Procedure:
1. To make sure that the preceding key has been released, 0s are
output to all rows at once, and the columns are read and checked
repeatedly until all the columns are high

• When all columns are found to be high, the program waits for a short
amount of time before it goes to the next stage of waiting for a key to
be pressed
2. To see if any key is pressed, the columns are scanned over and over
in an infinite loop until one of them has a 0 on it
• Remember that the output latches connected to rows still have their
initial zeros (provided in stage 1), making them grounded
• After the key press detection, it waits 20 ms for the bounce and then
scans the columns again
(a) it ensures that the first key press detection was not an erroneous one
due a spike noise
(b) the key press. If after the 20-ms delay the key is still pressed, it goes
back into the loop to detect a real key press
3. To detect which row key press belongs to, it grounds one row at a
time, reading the columns each time
• If it finds that all columns are high, this means that the key press
cannot belong to that row
– Therefore, it grounds the next row and continues until it finds the
row the key press belongs to
• Upon finding the row that the key press belongs to, it sets up the
starting address for the look-up table holding the scan codes (or
ASCII) for that row
Seven Segment Display:
• Seven segment displays are used to indicate numerical information.
• Seven segments display can display digits from 0 to 9 and even we can
display few characters like A, B, C, H, E,F, etc.
• These are very popular and have many more applications.
• Seven segment displays internally consist of 8 LEDs.
• In these LEDs, 7 LEDs are used to indicate the digits 0 to 9 and single
LED is used for indicating decimal point.
Types of Seven Segment Display:
• Generally seven segments are two types, one is common cathode and
the other is common anode.
Common cathode 7 segment Display:
Values for Common Cathode Display:
Hex
Digit Dp g f e d c b a
value

0 0 0 1 1 1 1 1 1 0x3f
1 0 0 0 0 0 1 1 0 0x06
2 0 1 0 1 1 0 1 1 0x5b
3 0 1 0 0 1 1 1 1 0x4f
4 0 1 1 0 0 1 1 0 0x66
5 0 1 1 0 1 1 0 1 0x6d
6 0 1 1 1 1 1 0 1 0x7d
7 0 0 0 0 0 1 1 1 0x07
8 0 1 1 1 1 1 1 1 0x7f
9 0 1 1 0 0 1 1 1 0x67
Thank You

You might also like