Philips P89LPC901 Light Therapy Device User Manual


 
Philips Semiconductors
User’s Manual - Preliminary -
P89LPC901/902/903
KEYPAD INTERRUPT (KBI)
2003 Dec 8 79
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 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 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.
Figure 11-1: Keypad Pattern Register- P89LPC901
Figure 11-2: Keypad Pattern Register - P89LPC902
KBPATN
Address: 93h
Not bit addressable
Reset Source(s): Any reset
Reset Value: 11111111B
BIT SYMBOL FUNCTION
KBPATN.5,4 - Pattern bit 5, bit 4
76543210
-
- KBPATN.5 KBPATN.4 - - - -
KBPATN
Address: 93h
Not bit addressable
Reset Source(s): Any reset
Reset Value: 11111111B
BIT SYMBOL FUNCTION
KBPATN.6-4,2,0 - Pattern bit 6 - bit 4, bit 2, bit 0
76543210
-
KBPATN.6 KBPATN.5 KBPATN.4 - KBPATN.2 - KBPATN.0