At 04:46 PM 2/22/00 -0500, Bill wrote:
I have an embedded computer which has four user
readable DIP switches on it. Board is running
at 3.3 volts. I want to be able to distinguish
between 7 possible SPST switches being closed
(one at a time) or all being open. I thought
"OK. I'll just convert the single switch event
to a binary number by hooking it to the appropriate
pins on the DIP switch. Then I'll prevent the
multi-bit numbers from cross feeding the single
bit events by putting diodes in." But, the diodes
have too much resistance for the board to see the
switch as closed. The single-bit switches, 1, 2
and 4, read just fine.
The diodes aren't your problem. The circuit is. Even 1N914 "glass" diodes
that you buy at radio shack will conduct at 3.3v. You are doing one row of
a keyboard matrix encoder consider the following lousy ASCII diagram.
The "*" are connection between wires, the D is a Diode pointed "down"
and
to the right. All inputs are presumed to be pulled up to Vcc when open
circuited. Note that since you are using "ground" as your reference you
can't detect switch #7 (only switches zero through six, although they can
be silk screened 1 through 7 :-) The logic must detect .7v as being logic 0
(usually not a problem)
Bit 0 ------*-------------*-------------*-------------*----
\ | | \ | | \ | | \ |
D | | D | | D | | D |
\| | \| | \| | \|
* | * | * | *
| | | | | | |
Bit 1 ----------|--*---|--*---|------|------|--*---|--*---|
| \ | \ | | | \ | \ |
| D | D | | | D | D |
| \| \| | | \| \|
| * * | | * *
| | | | | | |
Bit 2 ----------|------|------|--*---|--*---|--*---|--*---|
| | | \ | \ | \ | \ |
| | | D | D | D | D |
| | | \| \| \| \|
| | | * * * *
| | | | | | |
| | | | | | |
/ / / / / / /
/ / / / / / /
| | | | | | |
Ground ---------+------+------+------+------+------+------+
Switch # 7 6 5 4 3 2 1
--Chuck