MMC2001
KEYPAD PORT
MOTOROLA
REFERENCE MANUAL
14-9
Figure 14-7 Decoding Wrong Three Key Presses
14.4.7 Typical Keypad Configuration and Scanning Sequence
1. Configure keypad
a. Enable number of rows in keypad (KPCR[7:0]).
b. Write zeros to KPDR[15:8].
c. Configure keypad columns as open-drain (KPCR[15:8]).
d. Configure columns as output, rows as input (KDDR[15:0]).
e. Clear the KPKD status flag and synchronizer chain.
f. Set the KDIE control bit, and clear the KRIE control bit (avoid false release
events).
(now in standby mode, awaiting a keypress...)
2. Keypress interrupt detected
3. Begin keypad scanning routine
a. Disable keypad interrupts.
b. Write ones to KPDR[15:8], setting column data to ones.
c. Configure columns as totem-pole outputs.
d. Configure columns as open-drain.
e. Write a single column to zero, and write others to one.
f. Sample row inputs and save data. Multiple key presses can be detected on a
single column.
g. Repeat steps b to f for remaining columns.
h. Return all columns to zero in preparation for standby mode.
Column Pulled
Down
Column not
Pulled Down
Pulled Down Row
Pulled Down Row
Three Real
Key Presses
Ghost Key
Press
The path of the zero pull down
that reaches the wrong row and so
generates a ghost key press
Freescale Semiconductor,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc.
..