
Keypad Input
A keypad is simply an array of push buttons connected in rows and columns,
so that each can be tested for closure with the minimum number of connections
(Figure 4.5). There are 12 keys on a phone type pad (0–9, #, ∗), arranged in a
3⫻4 matrix. The columns are labelled 1, 2, 3 and the rows A, B, C, D. If we
assume that all the rows and columns are initially high, a keystroke can be de-
tected by setting each row low in turn and checking each column for a zero.
In the KEYPAD circuit in Figure 4.6, the 7 keypad pins are connected to Port
D. Bits 4–7 are initialised as outputs, and bits 0–2 used as inputs. These input
pins are pulled high to ...