18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7<br />

Figure 7-5. You can use a 74HC74 D-type flip-flop to latch a switch press. A<br />

second port pin clears the flip-flop.<br />

Adding a Keypad<br />

Keypads offer more options than individual switches or pushbuttons, but at lower cost and<br />

smaller size than a full keyboard. Examples of products that may use keypads include<br />

electronic locks, EPROM programmers, and many test instruments. On some devices, the<br />

keys have custom legends that describe the specific functions of the keys, but generic<br />

numbered keypads are also useful.<br />

Keypad Types<br />

Some keypads have attached cables that terminate in a connector. Others have headers to<br />

which you can solder wires or connect your own cable.<br />

Different keypads follow different decoding schemes for detecting which key is pressed.<br />

Some have a dedicated connector pin for each key and a single common pin to which the<br />

pins connect when a key is pressed (Figure 7-6). You can wire and access these like a series<br />

of individual switches, with a pull-up or pull-down resistor at each switch.<br />

Other keypads use matrix encoding, where the switch connections are arranged in a<br />

rectangular array. Figure 7-7 illustrates a typical hex keypad that uses matrix encoding. <strong>The</strong>re<br />

are four rows (Y) and four columns (X) to which the switches connect. Each key corresponds<br />

to a hexadecimal digit.<br />

116 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!