Searching \ for 'Open Collector, Buttons' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=open+collector+buttons
Search entire site for: 'Open Collector, Buttons'.

Truncated match.
PICList Thread
'Open Collector, Buttons'
1999\06\13@031104 by Ben Stragnell

flavicon
face
Hi,

I'm building a project which requires 4 pushbuttons to be attached to
a bus interface. I *could* obviously use a tristate buffer, but I'm
trying to keep the chip count down. I do have one spare pin on the
PIC (A2), so my initial solution was to have this pin as the common
connector to 4 switches, and have the other side of the switches
wired to B0-B3, (which is in use as part of a bus interface).
When the bus in in use, I float A2, so pressing a button doesn't
interfere with the bus operation. When I'm not using the bus, I flip
B0-B3 to inputs, set A2 high, read B0-B3, set A2 low, read B0-B3 again
and figure out which switches are closed. (Alternatively, make B0-B3
outputs, A2 input, strobe each in turn, and look for corresponding
strobe on A2).

Of course, a moment's thought demonstrates that if two switches are
closed at the same time, unspeakable confusion will occur, because
two of the bus lines will be shorted together, regardless of whether
or not A2 is floating, and when the bus *is* in use, disaster will
occur.

So, I'm thinking - presumably if I got a transistor for each line,
arranged in an open-collector configuration, such that B0-B3 remain
outputs, each driving a transistor, I could take the second
approach described above (use A2 as input), and it wouldn't matter
if two buttons were pressed simultaneously. (I don't need to detect
simultaneous presses - it's just that they can't interfere with
anything!).

My question is, (and once again, I'm forced to demonstrate my
complete lack of elec eng knowledge...), how exactly do I connect
the transistors? I need a series resistor on the base, yes? If so,
what sort of value should I use?

Alternatively, if anyone can suggest a simpler way to get around
this problem, I'm all ears!

Cheers,
Ben

1999\06\13@033143 by Ernie Murphy

flavicon
face
Ben,

If I understood what you are doing right (and I just gave it a quick
read... sorry) you can isolate the switches from your address lines by
simply adding a series diode to each switch. You can press 2 buttons and
all it does is connect the address lines with two back to back diodes...
which doesn't conduct.

Assuming you drive an address line high to see if a switch is closed, point
the diode from the PIC output to each switch. If you output lows to detect
switch closures, spin the diodes round the other way.

Mail me off list if this didn't make sense, and include a sketch of your
thing. I'll draw you what I mean.

Good luck with your project.

Ernie

At 12:15 AM 6/13/99 -0700, you wrote:
{Quote hidden}

1999\06\13@034012 by Don McKenzie

flavicon
face
Ernie Murphy wrote:
>
> Ben,
>
> If I understood what you are doing right (and I just gave it a quick
> read... sorry) you can isolate the switches from your address lines by
> simply adding a series diode to each switch. You can press 2 buttons and
> all it does is connect the address lines with two back to back diodes...
> which doesn't conduct.
>
> Assuming you drive an address line high to see if a switch is closed, point
> the diode from the PIC output to each switch. If you output lows to detect
> switch closures, spin the diodes round the other way.

Have a look at:
http://www.dontronics.com/dt102.html
nice little schematic of it there.

Don McKenzie  spam_OUTdonTakeThisOuTspamdontronics.com http://www.dontronics.com

Don's Download Dungeon:   http://www.dontronics.com/download.html
Australian Electronics Ring http://www.dontronics.com/aering.html
Win $500USD Cash. Micro design contest:  http://www.simmstick.com

1999\06\13@055348 by Stewart Pye

flavicon
face
Hi..


>(Alternatively, make B0-B3
>outputs, A2 input, strobe each in turn, and look for corresponding
>strobe on A2).

Yeah I'd do it this way:

Connect one side of each switch to A2 with a 10k pullup resistor to Vdd.
Connect the other side of the switches to B0-B3.

bring B0 low, with B1-3 high.
if RA2 is low key 1 is pressed.

bring B1 low, the others high
if RA2 is low key 2 is pressed.
etc

BTW if you had a pin on portb spare you could use an internal pullup so
wouldn't need the external one.


Regards,

Stewart Pye

At 12:15 AM 13/06/99 -0700, you wrote:
{Quote hidden}

1999\06\13@122510 by Ben Stragnell

flavicon
face
Doh! How did I miss that?

You guys are absolutely correct... diodes do the job just fine.

Thanks a million,

Ben

1999\06\25@104421 by Marc

flavicon
face
> You guys are absolutely correct... diodes do the job just fine.

You can also use resistors.  I do that - it saves space (vs SOT23), they can
come in packs (eg 4x0805) and have no polarity.

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...