Philips Semiconductors | User’s Manual - Preliminary - | |
|
|
|
KEYPAD INTERRUPT (KBI) | P89LPC906/907/908 | |
11. KEYPAD INTERRUPT (KBI) |
|
|
The Keypad Interrupt function is intended primarily to allow a single interrupt to be generated when the Port 0 bits are equal to or not equal to a certain pattern. This function can be used for 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
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 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 |
| 7 | 6 | 5 | 4 |
|
| 3 | 2 | 1 |
| 0 |
|
| |||||||
Address: 93h |
|
| - | KBPATN.6 | KBPATN.5 | KBPATN.4 |
|
| - | - | - |
| - |
|
| ||||||
Not bit addressable |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
Reset Source(s): Any reset |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reset Value: 11111111B |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BIT | SYMBOL | FUNCTION |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
KBPATN.6,5,4 | - | Pattern bits 6,5,4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
|
|
|
| Figure |
|
|
|
|
|
|
|
|
| ||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KBCON |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Address: 94h |
| 7 | 6 | 5 | 4 |
|
| 3 | 2 | 1 |
| 0 |
|
| |||||||
Not bit addressable |
|
| - |
| - |
| - |
| - |
|
| - |
| - |
| PATN_SEL | KBIF |
| |||
Reset Source(s): Any reset |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reset Value: xxxxxx00B |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BIT | SYMBOL | FUNCTION |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
- | Reserved |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||
KBCON.1 | PATN_SEL | Pattern Matching Polarity selection. When set, Port 0 has to be equal to the | |||||||||||||||||||
|
| 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. |
|
|
|
|
|
|
|
| |||||||||||
KBCON.0 | KBIF | 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 11-2: Keypad Control Register
2003 Dec 8 | 77 |