Freescale Semiconductor, Inc.
Application Note
Background
Dedicated Input
A microcontroller typically receives user input through digital input pins.
The simplest implementation is a single switch directly connected to a
digital input pin. This is easy to realize, but is not the most efficient use
of resources, with one pin dedicated to one input. One port data bit
represents the state of one switch.
Another method uses a keypad, a common element in embedded
systems. These are ordinarily arranged in a matrix, as shown in
In this case, the byte value of an entire port data register can
be polled to determine which key was pressed. This is more efficient, as
a 4 x 4 keypad can interface 16 keys with eight input pins.
Freescale Semiconductor, Inc...
Matrix Input
Px0
Px1
Px2
Px3
Px4
Px5
Px6
Px7
Figure 1. Resistor Matrix Keypad Using Parallel Port Pins
AN1775 Rev. 1
For More Information On This Product,
Go to: www.freescale.com