8279 Keyboard/Display Interface Microprocessor and Interfacing by Ravinder Nath Rajotiya - April 5, 2020April 25, 20220 Share on Facebook Share Send email Mail Print Print Table of Contents Toggle Keyboard TypesKeyboard Circuit connection and InterfacingKeyboard interfacingFlowchart for keyboard routineWhy Device Like 8279Basics about 82798279 Features:8279 internal structureImportant SignalsPort Addresses:Major internal components of the 8279:Initializing the 8279 for read operation 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 de-bounce 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. Why Device Like 8279 Though simple mechanism of interfacing the keyboard and displays with processer is possible with devices like 8255, but this approach kills the precious time of the CPU in keyboard scanning and display refresh routine. To relieve the processor from these tasks, a special device such as INTEL 8279 keyboard/display device is designed 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. For Keyboard control, 8279 constantly scans each row of Keyboard by sending out row address on SL3-SL0 and inputting signals on return lines RL7-RL0 which represent column address. SL3-SL0 are used for both the keyboard scanning and display refreshing and accommodate up to 16 display units When a key depress is detected, they key is automatically de-bounced by waiting 10ms to check if the same key remains depressed. If a key depressed is detected an 8-bit code word corresponding to the key position is assembled by combining the encoded column position, row position, shift and control status as: CNTL SHFT R R R C C C 8279 Features: Programmable keyboard and display interface controller Supports 64-key matrix keyboard with 2 key-lockout and n-key rollover Supports 16-digit display with many options Simultaneous keyboard and display operations 8-character FIFI memory 16-byte display RAM 8279 internal structure Figure shows the internal components of the 8279. It has basically three sections. These are: Display Section with its own 16-byte display RAM Keyboard scan section with FIFO registers Control logic for interfacing with processor Figure-3 Important Signals BD’ : Used to blank all display CLK : For proper operation of internal circuit of 8279 CTRL/STB’ : Input from Control keys in the keyboard Shift : Input to 8279 from Shift key of keyboard IRQ : IRQ from the 8279 to the processor OUT A0 – A3 and B0 – B3 : data output lines to the display from 8279 Reset : Connected to Reset out of the processor SL0 – SL3: four scan lines – there are two programmable options for the scan lines, these are encoded and decoded mode. In encoded modes, these lines must be decoded externally. In decoded mode these lines are already decoded and provide one of four lines as active low signal. RL0 – RL7 : Return lines used to sense a key press in keyboard matrix. Port Addresses: CS’ is used to select the IC RD’ and WR’ used to indicate data direction A0 address line is used to select the data or control register : – If A0 = ‘1’, content of data bus is command or status. If A0 = ‘0’ content of data bus is data for the IC CS’ RD’ WR’ A0 Port Address Description 0 1 0 0 Even Data Bus to Data Buffer Reg 0 1 0 1 ODD Data bus to control register 0 0 1 0 Even data buffer register to data bus 0 0 1 1 ODD status register to data bus As shown above control and status registers have odd address and data buffer register uses even address Major internal components of the 8279: 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. 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 Number of bytes in FIFO memory 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. 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. The formats of these commands is : Mode set Commands Specific to a particular Mode/command set M M M First 3-bit determine the type of control. And rest five depend on the type. These are : Sl Mode Bits Description 1 000 Keyboard display mode set- control word to select number o displays, display position, and type of key scan 2 001 Program Clock 3 010 Read FIFO sensor memory 4 011 Read Display RAM 5 100 Write control word before writing data to display memory 6 101 Display write inhibit/Blanking 7 110 Clear display and FIFO 8 111 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. 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 here DD KKK- description 00 – Left Entry, eight 8-bit displays 01 – left entry, sixteen 8-bit display 10 – Right Entry, eight 8-bit displays 11 – Right entry, sixteen 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: 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. 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. 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 AI X A A A AAA – Row address to be read in sensor mode AI=1 – auto increment to next byte from FIFO In scan keyboard mode, AI and AAA become irrelevant or are the don’t care 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 AI=1 A A A A 0 – 1 0 – 1 0 – 1 0 – 1 Initializing the 8279 for read operation In the figure SL2-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 ; TEST performs a bitwise AND operation 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 JNZ NEXT To display a character from memory stored at location DIGITS on the display unit, the steps are: Initialize the 8279 in write to display RAM Send the characters at the address of data bus buffer(DX) Initialize 8279 in write to display MOV SI, 8 MOV DX, OFFE9h MOV AL, 10010000B ;initialize 8279 in write to display RAM OUT DX, AL 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 Share on Facebook Share Send email Mail Print Print