MMC2001
KEYPAD PORT
MOTOROLA
REFERENCE MANUAL
14-3
Setting a column open-drain enable bit (KCO[7:0]) disables the pull-up driver on that
pin. Clearing the bit allows the pin to drive to the high state. This bit has no effect
when the pin is configured as an input.
Setting a row enable control bit in this register enables the corresponding row line to
participate in interrupt generation. Likewise, clearing a bit disables that row from
being used to generate an interrupt. This register is cleared by reset, disabling all
rows. The row enable logic is independent of the programmed direction of the pin.
Writing a zero to the data register of pins configured as outputs causes a keypad
interrupt to be generated if the row enable associated with that bit is set. It is up to the
programmer to ensure that pins being used for functions other than the keypad are
properly disabled.
The KPCR register is byte or halfword addressable.
Figure 14-2 Keypad Control Register
KCOx — Keypad Column Strobe Open-Drain Enable x
0 =
Column strobe output x is totem-pole drive (P-channel enabled).
1 =
Column strobe output x is open drain (P-channel disabled).
KREx — Keypad Row Enable x
0 =
Row x is not included in keypad key press detect.
1 =
Row x is included in keypad key press detect.
14.3.2 Keypad Status Register (KPSR)
The keypad status register (KPSR) reflects the state of the keypress detect circuit.
The keypad key depress (KPKD) status bit is set when one or more enabled rows are
detected low after synchronization. The KPKD status bit remains set until cleared by
software. The KPKD bit may be used to generate a maskable key depress interrupt. If
desired, software may clear the keypress synchronizer chain to allow a repeated
interrupt to be generated while a key remains pressed. In this case, a new interrupt
will be generated after the synchronizer delay elapses if a key remains pressed.
The keypad key release (KPKR) status bit is set when all enabled rows are detected
high after synchronization. The KPKR status bit remains set until cleared by software.
The bit will typically not be set again until the detect circuit senses a key depressed
followed by all keys released. The KPKR bit may be used to generate a maskable key
release interrupt. The key release synchronizer may be set high by software after
scanning the keypad to ensure a known state.
KPCR — Keypad Control Register
10003000
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
R
KCO7
KCO6 KCO5 KCO4
KCO3
KCO2
KCO1 KCO0
KRE7
KRE6
KRE5
KRE4
KRE3
KRE2
KRE1
KRE0
W
RESET:
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Freescale Semiconductor,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc.
..