# Revision Help Needed

Discussion in 'Electronic Basics' started by Graham Johnson, Jun 6, 2004.

1. ### Graham JohnsonGuest

Please could some very kind person out there help me with this
revision question.

Q)What problems can be encountered when using switches as inputs to a
microcomputer and how can these problems be overcome.

2. ### R. Steve WalzGuest

----------------------
Answers are, pullup resistors to Vcc on each switch, the switch to
switch ground to assure the input line *IS* in one logic state or the
other, and switch debouncing, look it up.

-Steve

3. ### CFoley1064Guest

Subject: Revision Help Needed
Good evening, Mr. Johnson. You have several challenges when using switches as
uC inputs. A switch is either open or closed, and a logic input is either Vcc
or Gnd. That's solved by using a pullup resistor, and then making the switch
contact to Gnd. That will give you a logic "1" when the switch is open, and a
logic "0" when closed. Or, you can do the reverse, with a pulldown, and switch
contact to Vcc. Closed = 1, open = 0. Simple, right?

Unfortunately, there's a few potential flies in the ointment. The first one is
that the pullup resistor used (1K to 10K is popular) may not supply enough
current to meet the minimum current rating of the switch. That will result in
increasing contact resistance over time, and eventual false readings of the
switch. To solve this, you get a switch which has "dry contact" rating.
Usually that means you have a self-wiping contact, and also usually there's
gold flash on the contacts. Look at the switch manufacturer ratings under
minimum current, and look for the words "dry contact". Choose your switch
well, and this won't be a problem.

A second, unrelated problem is ESD. The customer will want to use the switch
when he wants to, and probably won't check to see if he's got a static charge
on. I've seen systems where the uC dies when someone touches the switch.
That's because the voltage discharges through the switch body into the contact,
and into the uC circuit. There are a number of ways to work with this,
including series resistors, TVS, small caps, and diode protection to the supply
rails. It's up to you how you want to deal with this, and how much you want to
spend in time and treasure. But unless you're going to really, really promise
that anyone using the switch will be wearing a good ground strap, you'll have
to be aware of the issue.

Hope this has been of help.

Good luck
Chris