8279 Keyboard/Display Interface

Keyboard Types

  • Mechanical key switches
  • Membrane type: with advantage that they can be made very thin and sealed
  • Capacitive Type: When a key is pressed the capacitance between the plates varies.
  • Hall effect: No mechanical contact. It take advantage of the deflection of a moving charge by a magnetic field.

Keyboard Circuit connection and Interfacing

  • Detect a key press
  • De-bounce the key press
  • Encode the valid key to produce a standard code for pressed key
  • The above three tasks can be performed with hardware, software or a combination depending on the application

Keyboard interfacing

  • Figure show the interfacing of the keypad using 8255. The rows of the keypad are connected to say PORT-A and columns connected to PORT-B.
  • PA is in output mode and PB in the input mode
  • 8255 send ‘0’ on rows and the columns values are read to detect if a key was pressed.
  • To handle the multi-key press problems, special routines are written to avoid false key reading.




Flowchart for keyboard routine


  • Figure-1

    Figure explains the procedure for reading the key value.

  • Initially all keys are open. To be sure, we check it by sending ‘0’s on all rows. If any key is yet pressed we go back and check for all key open.
  • If all keys were open, we can now check any key closure, by reading the column value. If key was pressed, after a debounce time we again read the column value to be sure of the key pressed.
  • If a key was pressed, we now assemble the code for the key pressed.


8279 internal structure

Though simple mechanism of interfacing the keyboard and displays with processer is possible, but this approach kills the precious time of the CPU in keyboard scnning  and display refresh routine. To relieve the processor from these tasks, a special device such as INTEL 8279 keyboard/display device is designed.

CS’       RD’      WR’     A0        Transfer Description

0          1          0          0          Data Bus to Data Buffer Reg

0          1          0          1          Data bus to control register

0          0          1          0          data buffer reg to data bus

0          0          1          1          status register to data bus

As shown above control and status registers have odd address and data buffer register uses even address


Basics about 8279

8279 is a programmable keyboard and display interface. This is a very simple IC which relieves the engineer from the complex task of interfacing the keyboard and display unit in different modes of operation.

  1. For Keyboard control, 8279 constantly scans each row of KB by sending out row address on SL2-SL0 and inputting signals on return lines RL7-RL0 which represent column address.
  2. SL3-SL0 are used for both the keyboard scanning and display refreshing and accommodate up to 16 display units
  3. When a key depress is detected, they key is automatically debounced by waiting 10ms to check if the same key remains depressed. If a key depressed is detected an 8-bit codeword corresponding to the key position is assembled by combining the encoded column position, row position, shift and control status as:

The major internal components of the 8279 are:

  1. 16-Byte display memory:

8279 has a 16-byte display memory and refresh logic. Since 16 display units can be interfaced, each address corresponds to a display unit. The character in this display is sent out to the display over the out lines A3-0, B3-0. Once the CPU loads a character in this memory, 8279 does not then need any command for refreshing the display unit. That is taken care of by 8279.

  1. Status Register: It is an 8-byte FIFO register.
D7 D6 D5 D4 D3 D2 D1 D0
Display available Y/N Closure when in sensor mode Underflow when attempt made to read empty FIFO. Overflow is when attempt made to write full FIFO FIFO memory Full No. of bytes in FIFO memory



  1. An 8-byte FIFO sensor memory: This is 8-chracter FIFO memory. 8 characters can be stored on FIFO basis. These stored word/characters can be read at any time. Storing more than 8 bytes or reading an empty sensor memory lead to overflow and underflow respectively.
  2. Timing and Control Unit
  • The timing and control unit is a collection of flags and registers that are accessed by commands which are sent to 8279’s odd address whose format is :
Mode  set Commands Specific to a particular Mode/command set


First 3-bit determine the type of control. And rest five depend on the type. These are :

Mode Bits
Keyboard display mode set
Program Clock
Read FIFO sensor memory
Read Display RAM
Write to display memory
Display write inhibit/Blanking
End interrupt/Error Mode set

Important Control commands: Though there are eight different modes in which 8279 can be set, but the most important three are given below.

  1. Keyboard display Mode set: The most three bits =”000” specifies keyboard and display mode and is used to initialize the 8279

The format is:

Keyboard display Mode Display control bits Keyboard control bits
0 0 0 D D K K K


KKK- description
00 – Left Entry, 8 8-bit displays

01 – left entry, 16 8-bit display

10 – Right Entry, 8 8-bit displays

11 – Right entry, 16 8-bit display

000 – Encoded KB scan mode with 2-key lockout

001 – Decoded KB scan mode with 2-key lockout

010 – Encoded KB scan mode with N-key rollover

011 – Decoded KB scan mode with N-key rollover

100 – Encoded sensor matrix scan mode

101 – Decoded sensor matrix scan mode

110 – Strobed input with encoded display scan

111–Strobed input with decoded display scan



In the keyboard scan mode, a read is always from the byte which entered first in FIFO, hence I and AAA are ignored in this mode.

There are situations when more than two keys is pressed simultaneously. 8279 provide two ways of handling this situation. These are:

  1. Two-key lockout option: In this mechanism, if another key is pressed while the first key is being de-bounced, the key code of key which is released last is entered in FIFO.
  2. N-key rollover: In this mechanism all keys in the order in which they are pressed after the first are entered in FIFO in the same order.


  1. Read FIFO Sensor Memory: Its format is :
Read FIFO Sensor Memory Mode Auto increment control bits Row address to be read in sensor mode
0 1 0 I X A A A


AAA – Row address to be read in sensor mode

I=1-auto increment to next byte from FIFO

  1. Write to display RAM Mode
Write to display RAM Mode Auto increment control bits Address of next location in display memory, where data for next write is stored
1 0 0 1 A A A A


Initializing the 8279 for read operation

In the figureSL2-0 lines are connected to 8 display unit. They drive the drivers of the display unit. Also RL7-0  and SL2-0 through decoder are connected to rows and columns of the 64key keyboard. OUTA3-0 and OUTB3-0 are connected to the segment drivers of the segment displays. The CS’ and A0 are so connected that the two addresses formed are 0FFE8 and 0FFE9h. Referring to the format for KB mode with encoded scan mode with two-key lockout and left entry 8-bit display as

Keyboard display Mode Display control bits Keyboard control bits (here it is scan mode)
0 0 0 0 0 0 0 0


The initialization instructions are:

MOV    DX,       0FFE9

MOV    AL,       00h

OUT     DX,       AL

Note that with scan mode,read is always from the byte which first entered the FIFO, therefore the bit I and AAA are ignored

Read FIFO Sensor Memory Mode Auto increment control bits Row address to be read in sensor mode
0 1 0 I X A A A

MOV    DX,       0FFE9h

MOV    AL,       01010000B;

OUT     DX,       AL

The following instructions force the CPU to be idle until an input is ready

NEXT: MOV     DX,       0FFE9h

IDLE:    IN         AL,       DX

            TEST    AL,       0Fh

            JZ         IDLE

Read from data buffer to data bus, is when the address is even FFE8

MOV    DX,       0FFE8h

IN         AL,       DX

Store the character in AL in memory at address KEY[SI]

MOV    KEY[SI-1],         AL

DEC     SI


To display a character from memory stored at location DIGITS on the display unit, the steps are:

  1. Initialize the 8279 in write to display RAM
  2. Send the characters at the address of data bus buffer(DX)
  3. Initialize 8279 in write to display

MOV    SI,        8


       MOV    AL,       10010000B          ;initialize 8279 in write to display RAM

       OUT     DX,       AL

  1. Write the character at the address of data bus buffer.

MOV    DX,       0FFE8h

AG:      MOV    AL, DIGITS(SI-1]

            OUT     DX,       AL

            DEC     SI

            JNZ      AG

error: Content is protected !!