Truncated match.
PICList
Thread
'Keyboard decoders and design philosophy'
1999\01\09@130545
by
Michael Mullen
|
I usually use a '138 and a '151 (3-8 decoder, 8-3 mux) to scan up to a 64 key
keyboard. Use the output of the mux as an input to see if a key is pressed.
Operation is simple:
for i=0 to 63
port =i
if input low then
//key has been pressed, do something
endif
next i
Uses 7 pins, but the 'ls (or hc or whatever) chips are cheap and multiple
sourced. Can also prefix the address pins with a 6 bit counter, then you can
use 3 wires. Clear counter, clock counter, check input.
Philosophic note:
There is no "best" keyboard encoder -- or usually, anything other function.
The above is a low cost hardware solution, rapid machine execution, and
trivial programming. Shift registers save pins, but require more programming
and longer execution times. Also harder for a newbie to debug. I am building
things in 100 quantities, and adding a $.05 part to save an hour of
programming or design time is about a wash. If you're doing this for fun,
designing stuff for 100k/year production rates, or building life-support
equipment, you get different answers. I have designed stuff for
geosynchronous weather satellites (production rates 1/year) and video games (1
million/year), and believe me, you get different answers for the same problem.
Mike Mullen
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- Today
- New search...