Keyboard interface, Introduction, Description – Rainbow Electronics AT89C5131 User Manual
Page 99

99
AT89C5131
4136A–USB–03/03
Keyboard Interface
Introduction
The AT89C5131 implements a keyboard interface allowing the connection of a 8 x n
matrix keyboard. It is based on 8 inputs with programmable interrupt capability on both
high or low level. These inputs are available as an alternate function of P1 and allow to
exit from idle and power down modes.
Description
The keyboard interface communicates with the C51 core through 3 special function reg-
isters: KBLS, the Keyboard Level Selection register (Table 74), KBE, The Keyboard
interrupt Enable register (Table 73), and KBF, the Keyboard Flag register (Table 72).
Interrupt
The keyboard inputs are considered as 8 independent interrupt sources sharing the
same interrupt vector. An interrupt enable bit (KBD in IE1) allows global enable or dis-
able of the keyboard interrupt (see Figure 40). As detailed in Figure 41 each keyboard
input has the capability to detect a programmable level according to KBLS.x bit value.
Level detection is then reported in interrupt flags KBF.x that can be masked by software
using KBE.x bits.
This structure allow keyboard arrangement from 1 by n to 8 by n matrix and allow usage
of P1 inputs for other purpose.
Figure 40. Keyboard Interface Block Diagram
Figure 41. Keyboard Input Circuitry
P1.0
Keyboard Interface
Interrupt Request
KBD
IE1.0
Input Circuitry
P1.1
Input Circuitry
P1.2
Input Circuitry
P1.3
Input Circuitry
P1.4
Input Circuitry
P1.5
Input Circuitry
P1.6
Input Circuitry
P1.7
Input Circuitry
KBDIT
P1:x
KBE.x
KBF.x
KBLS.x
0
1
Vcc
Internal Pull-up