Keypad Interrupt (Kbi) - Philips P89LPC920 User Manual

80c51 8-bit microcontroller with two-clock core
Table of Contents

Advertisement

Philips Semiconductors

KEYPAD INTERRUPT (KBI)

12. KEYPAD INTERRUPT (KBI)
The Keypad Interrupt function is intended primarily to allow a single interrupt to be generated when Port 0 is equal to or not equal
to a certain pattern. This function can be used for bus address recognition or keypad recognition. The user can configure the port
via SFRs for different tasks.
There are three SFRs used for this function. The Keypad Interrupt Mask Register (KBMASK) is used to define which input pins
connected to Port 0 are enabled to trigger the interrupt. The Keypad Pattern Register (KBPATN) is used to define a pattern that
is compared to the value of Port 0. The Keypad Interrupt Flag (KBIF) in the Keypad Interrupt Control Register (KBCON) is set
when the condition is matched while the Keypad Interrupt function is active. An interrupt will be generated if it has been enabled
by setting the EKBI bit in IEN1 register and EA = 1. The PATN_SEL bit in the Keypad Interrupt Control Register (KBCON) is used
to define equal or not-equal for the comparison.
In order to use the Keypad Interrupt as an original KBI function like in the 87LPC76x series, the user needs to set KBPATN =
0FFH and PATN_SEL = 0 (not equal), then any key connected to Port0 which is enabled by KBMASK register is will cause the
hardware to set KBIF = 1 and generate an interrupt if it has been enabled. The interrupt may be used to wake up the CPU from
Idle or Power down modes. This feature is particularly useful in handheld, battery powered systems that need to carefully manage
power consumption yet also need to be convenient to use.
In order to set the flag and and cause an interrupt, the pattern on Port 0 must be held longer than 6 CCLKs.
KBPATN
Address: 93h
Not bit addressable
Reset Source(s): Any reset
Reset Value: 11111111B
BIT
SYMBOL
KBPATN.7-0
-
KBCON
Address: 94h
Not bit addressable
Reset Source(s): Any reset
Reset Value: xxxxxx00B
BIT
SYMBOL
KBCON.7-2
-
KBCON.1
PATN_SEL
KBCON.0
KBIF
2003 Dec 8
7
6
KBPATN.7 KBPATN.6 KBPATN.5 KBPATN.4 KBPATN.3 KBPATN.2 KBPATN.1 KBPATN.0
FUNCTION
Pattern bit 7 - bit 0
Figure 12-1: Keypad Pattern register
7
6
-
-
FUNCTION
Reserved
Pattern Matching Polarity selection. When set, Port 0 has to be equal to the user-defined
Pattern in KBPATN to generate the interrupt. When clear, Port 0 has to be not equal to the
value of KBPATN register to generate the interrupt.
Keypad Interrupt Flag. Set when Port 0 matches user defined conditions specified in
KBPATN, KBMASK, and PATN_SEL. Needs to be cleared by software by writing "0".
Figure 12-2: Keypad Control register
5
4
3
5
4
3
-
-
-
83
User's Manual - Preliminary -
P89LPC920/921/922
2
1
0
2
1
0
PATN_SEL
-
KBIF

Advertisement

Table of Contents
loading

This manual is also suitable for:

P89lpc921P89lpc922

Table of Contents