Sunteți pe pagina 1din 31

8279 KEYBOARD/DISPLAY INTERFACE

Interfacing Keyboard/Display to the Microprocessor


Using Intel 8279

Keypad De-Bouncing
key bounce, tBOUNCE key bounce, tBOUNCE typically, tBOUNCE < 10 ms
NONE
NONE NONE

NONE

wait debouncing period

wait until all keys released

wait debouncing period


wait until any key pressed

wait until any key pressed

decode_key; action dependent on the key

Description
Hardware approach to interfacing a matrix keyboard and a multiplexed display. Disadvantage of the software approach is that the microprocessor is occupied for a considerable amount of time in checking the keyboard and refreshing the display. 40 pin device. has two major segments : Keyboard & Display. Keyboard is connected to a 64-contact key matrix. Keyboard entries are debounced and stored in the internal FIFO memory; an interrupt signal is generated with each entry. Display segment can provide a 16-character scanned display interface and has 168 RAM, which can be used to read/write information for display purposes. Display can be set up in either right-entry (Calculator) (or) left-entry (Typewriter) mode.

Block Diagram of 8279


IRQ RD CLK RESET WR CS A0

Data Buffers

I/O Control

FIFO/Sensor RAM Status

Internal Data Bus (8)

Display Address Registers

168 Display RAM Display Registers

Control & Timing Registers Timing & Control Registers


BD

88 FIFO/Sensor RAM

Keyboard debounce and Control

Scan Counter
SL0-SL3

Return
SHIFT CNTL/STB RL0-RL7

OUT A0-A3

OUT B0-B3

Major Sections of 8279


1) CPU Interface Section 2) Keyboard Section

3) Scan Section
4) Display Section

CPU Interface Section


has eight (8) bi-directional data lines (DB0-DB7), one interrupt request line (IRQ) and six more lines (CLK, RESET, RD, WR, CS and A0). If A0=1(high), signals are interpreted as control (or) status words. If A0=0(low), signals are interpreted as data The IRQ line goes high whenever data entries are stored in the FIFO RAM and this line is used to interrupt the MPU to indicate the availability of data.

Continued. A0 0 0 RDbar WRbar 1 0 0 1 Operation MPU writes the data in 8279 MPU reads the data from 8279

1
1

1
0

0
1

MPU writes the control word to 8279


MPU reads the status word from 8279

Keyboard Section
Includes 88 FIFO (First In First Out) RAM consisting of eight (8) registers that can store eight (8) keyboard entries. Each is then read in the order of entries. The status logic (FIFO/Sensor RAM Status) keeps track of the number of entries and provides an IRQ (Interrupt Request) signal when the FIFO is not empty. Has eight return lines (RL7-RL0), connected to the eight columns of a keyboard.

Continued

has two additional lines : SHIFT & CNTL/STB. status of the SHIFT & CNTL (control) key can be stored along with the key closure. The keys are automatically debounced , and the keyboard can be operated in either of the two modes, (i) Two-key lockout : if two keys are pressed simultaneously, only the first key is recognized. (ii) N-key roll over : simultaneously pressed keys are stored in the internal buffer and no key is recognized until only one key remains pressed.

Scan Section

has a scan counter & four scan lines (SL3-SL0). Scan lines (4) can be decoded by using a 4-to-16 decoder to generate 16 lines for scanning. These lines can be connected to the rows of a matrix keyboard.

Display Section has eight (8) output lines divided into two groups A0-A3 & B0-B3. can be used either as a group of 8 lines (or) as two groups of four. display can be blanked by using BD Includes 168 display RAM. MPU can read (or) write into any of these registers.

Operating Modes of 8279

(1) Keyboard/Display Mode set


Code
D 0 0 1 1 K 0 0 0 0 1 1 1 1

0
D 0 1 0 1 K 0 0 1 1 0 0 1 1

K
Operation

Eight 8-bit character display-Left entry Sixteen 8-bit character display-Left entry Eight 8-bit character display-Right entry Sixteen 8-bit character display-Right entry K 0 1 0 1 0 1 0 1 Operation Encoded Scan Keyboard-2 key lockout Decoded Scan Keyboard-2 key lockout Encoded Scan Keyboard-N- key rollover Decoded Scan Keyboard-N- key rollover Encoded Scan Sensor Matrix Decoded Scan Sensor Matrix Strobed Input, Encoded Display Scan Strobed Input, Decoded Display Scan

(2) Program Clock


Code
0 0 1 P P P P P

All timing & multiplexing signals for 8279 are generated by an internal prescalar. Pre-scalar divides the external clock by a programmable integer. Bits PPPPP determine the value of this integer which ranges from 2 to 31.

(3) Read FIFO/Sensor RAM


Code 0 1 0 AI X A A A

CPU sets up the 8279 for a read of the FIFO/Sensor RAM by first writing this command. In the scan keyboard mode, the Auto Increment flag (AI) and the RAM address bits (AAA) are irrelevant. (i.e) 8279 will automatically drive the data bus for each subsequent read in the same sequence in which the data first entered the FIFO RAM. In the sensor matrix mode, the RAM address bits AAA select one of the 8 rows of the Sensor RAM and if AI=1, each successive read will be from the subsequent row of the sensor RAM.

(4) Read Display RAM


Code

AI

CPU sets up the 8279 for a read of the Display RAM by first writing this command. The address bits AAAA select one of the 16-rows of the Display RAM. If AI=1, this (current) row address is incremented after each write command to the display RAM.

(5) Write Display RAM


Code

AI

CPU sets up the 8279 for a write to the Display RAM by first writing this command. The address bits AAAA select one of the 16-rows of the Display RAM. If AI=1, this (current) row address is incremented after each read command to the display RAM.

(6) Display write Inhibit/Blanking


A B A B

Code

IW

IW

BL

BL

IW bits can be used to mask nibble A & nibble B in application requiring separate 4bit display ports. By setting IW flag (IW=1), for one of the ports, the port becomes masked. The BL flags are available for each nibble.

(7) Clear
Code 1 1 0 CD2 CD1 CD0 CF CA CD2-CD0 bits available in this command are used to clear all rows of the display RAM to a selectable blanking code as follows:
CD2 1 1 1 CD1 0 1 1 CD0 X 0 1 Function All zeros (for common cathode displays) AB=(20)H=(0010 0000)B (for alphanumeric displays) All ones (for common anode displays)

CD2 must be 1 to enable clear display mode

If CF=1, FIFO status is cleared & the interrupt output line is reset. CA =1, clear all bits. (has the combined effect of CD bits and CF).

(8) End Interrupt/Error mode set Code


1 1 1 E X X X X

In sensor matrix mode, this command lowers the IRQ (Interrupt Request) line and enables further writing into RAM. In N-key roll over mode, if E=1, the chip will operate in the special error mode.

1.Write a command word to read third location with autoincrement of the sensor RAM in sensor matrix mode

Code
0 1 0

1 0 AI X

0 A

1 A

1 A

Command Word = 53H

2.Write a command word to write fifth location without auto-increment of the display RAM

Code
1 0 0

0 0 AI A

1 A

0 A

1 A

Command Word = 85H

3.Write a command word to read fourth location with autoincrement of the display RAM

Code
0 1 1

1 0 AI A

1 A

0 A

0 A

Command Word = 74H

4.Write a command word to inhibit nibble A & to blank nibble B of the display

Code
1 0 1

0 IW 1 IW 0 BL 0 BL 1 X (A) (B) (A) (B)

Command Word = A9H

5.Write a command word to clear IRQ line in sensor matrix mode

Code
1 1 1

1 0 E

0 X

0 X

0 X

0 X

Status of E-bit can be 0 or 1. Command Word = E0H Command Word = F0H

6.Give the command word to set keyboard/display for the following configuration: (i) Encoded scan keyboard N Key rollover (ii) Sixteen 8-bit character display Left entry

Code
0 0 0

0 D

1 D

0 K

1 K

0 K

Command Word = 0AH

7.Write a command word to set blanking code for common anode display & to clear the FIFO RAM Status

Code
1 1 0

1
CF

0
CA

CD2 CD1 CD0

Blanking code for common anode display is all ones (CD1 & CD0).

Command Word = DEH

8.Find the program clock word if external clock frequency is 2 MHz.

Code

1 P

0 P

1 P

0 P

0 P

To give proper scan & key debounce times, the internal frequency should be 100 KHz
Pre-scalar value = External Clock / Internal Frequency Pre-scalar value = (2x106) / (100x103) = (20)D = (10100)H = (PPPPP)

Command Word =(0011 0100)2 = 34H

S-ar putea să vă placă și