Вы находитесь на странице: 1из 19

KEYBOARD/ DISPLAY

Keyboard Interfacing
Key debounce: Pushbutton Keys are used.
These push button keys when pressed, bounces a few times therefore microprocessor wait until the key reach to a steady state. This is known as keydebounce.
The reading of one contact as multiple inputs can be eliminated by a key-debounce technique, using either hardware or software.

Interfacing Push-Button Keys

Hardware technique

Software Technique
The steps involved in this process are: 1. Check whether all keys are open 2. Check a key closure 3. Identify the key 4. Find the binary key code for the key

Interfacing Push-Button Keys - Software Debounding


Checking a key closure
When a key is open, the logic level is one (assuming pull-ups are enabled) and when it is closed, the logic level is zero. When all keys are open, the reading will be 0xFF, and when a key is closed, the reading will be less than 0xFF.
Therefore, any reading less than FFH indicates a key closure. This will be the first read!

Debouncing the key


Software technique
Wait for 20 ms. Read the port again. If the reading is still less than FFH, it indicates that a key is pressed.

Encoding the key


Key closure can be identified by rotating the reading right and looking for No Carry and counting the rotations

Interfacing Seven-Segment LEDs as an Output (1 of 4)


Seven-segment LEDs
Often used to display BCD numbers (1 through 9) and a few alphabets A group of eight LEDs physically mounted in the shape of the number eight plus a decimal point as shown in Figure 9-5 (a) Each LED is called a segment and labeled as a through g.

Interfacing Seven-Segment LEDs as an Output (2 of 4)


Two types of sevensegment LEDs
Common anode Common cathode

decimal point

Interfacing Seven-Segment LEDs as an Output (3 of 4)


In a common anode sevensegment LED
All anodes are connected together to a power supply and cathodes are connected to data lines

Logic 0 turns on a segment. Example: To display digit 1, all segments except b and c should be off. Byte 11111001 = F9H will display digit 1.

Interfacing Seven-Segment LEDs as an Output (4 of 4)


In a common cathode sevensegment LED
All cathodes are connected together to ground and the anodes are connected to data lines

Logic 1 turns on a segment. Example: To display digit 1, all segments except b and c should be off. Byte 00000110 = 06H will display digit 1.

Matrix Keyboard and Multiplexed Display Interface


A matrix keyboard is a commonly used input device when more than eight keys are necessary The interfacing of a matrix keyboard requires one input port and one output port Rows are connected to the output port and columns are connected to the input port

Matrix Keyboard and Multiplexed Display Interface

Intel 8279 Keyboard/Display Controller


Intel 8279 is the keyboard/display controller that is used to interface the keyboard and the display of a system to the microprocessor The advantage of 8279 is that it is able to drive the signals for both the keyboard and display and hence it is possible for the microprocessor to concentrate in its routine tasks The 8279 has two sections: keyboard and display

Intel 8279 Keyboard/Display Controller


The 8279 chip provides a set of four scan lines and eight return lines for interfacing keyboards and a set of eight output lines for interfacing display The keyboard portion can provide a scanned interface to a 64-contact key matrix The keyboard portion interfaces an array of sensors or a strobed interface keyboard

Intel 8279 Keyboard Section


Keyboard depressions can be 2-key lockout or N-key rollover Keyboard entries are debounced and strobed in an 8-charcter FIFO If more than 8 characters are entered, overrun status is set Key entries set the interrupt output line to the CPU

2 Key Lockout
In scanned keyboard mode with 2 key lockout, when a key is pressed, a debounce logic comes into operation During the next two scans, the other keys are checked for closure and if no other is pressed the first pressed key is identified The key code of the identified key is entered into the FIFO with SHIFT and CNTL status, provided that FIFO is not full, that is it has at least one byte free If the FIFO does not have any free byte, naturally the key data will not be entered and the error flag is set

N-Key Rollover
In scanned keyboard with N-key rollover each key depression is treated independently When a key is pressed the debounce circuit waits for two keyboard scans and then checks whether the key is still depressed If it is still depressed, the code is entered in FIFO RAM Any number of keys can be pressed simultaneously and recognized in the order, the keyboard scan recorded them All the codes of such keys are entered into FIFO

Intel 8279 Display Section


The display portion provides a scanned display interface for LED, incandescent and other popular display technologies Both numeric and alphanumeric segment displays may be used as well as simple indicators The 8279 has 16*8 display RAM which can be organized into dual 16*4 Both right entry, calculator and left entry typewriter display formats are possible Both read and write of the display RAM can be done with auto-increment of the display RAM address

Functional Block Diagram

Вам также может понравиться