Re: Calculating resistors required

From: Peter Bennett (peterbb_at_somewhere.invalid)
Date: 12/31/04


Date: Fri, 31 Dec 2004 11:24:53 -0800

On Fri, 31 Dec 2004 16:30:27 +0000, Danny T <danny@nospam.oops> wrote:

>Anthony Fremont wrote:

>> The goal is to never have an input pin in a "floating" state. They are
>> suggesting that you use a pull-up resistor on the pin so that when the
>> switch isn't closed(pressed), the input pin sees a logic 1 (+5V) via the
>> juice feeding thru the pull-up. Then you have the switch so that it
>> shorts the pin directly to ground when pressed. The pull-up resistor
>> will limit how much current is flowing to ground, and the input pin will
>> "see" a logic 0. This way, the input pin is always connected to a
>> voltage reference of 5V or 0V.
>
>My only question here, is that a switch would then give logic 0. I
>thought it would be reversed, and a 1 would mean the switch is pressed.
>Is that the usual way of doing things?

The tradition of using pull-up resistors and a switch to ground comes
from the characteristics of a TTL logic input. TTL inputs required a
fairly low resistance to ground before they would consider it a logic
low, and if the input was left open-circuit, would normally consider
it a high (but it is still good practice to use pull-up resistors).

CMOS inputs, as on most microcontrollers, don't source or sink any
current - if left unconnected, they will be in an unknown intermediate
state. Since they don't supply any significant current in either
state, you can use a fairly high value of resistor to pull the input
either high or low - then use the switch to pull it in the other
direction.

-- 
Peter Bennett, VE7CEI  
peterbb4 (at) interchange.ubc.ca  
new newsgroup users info : http://vancouver-webpages.com/nnq
GPS and NMEA info: http://vancouver-webpages.com/peter
Vancouver Power Squadron: http://vancouver.powersquadron.ca


Relevant Pages

  • Re: Octavia windscreen wipers.
    ... Remove the trim around the speedometer. ... there are two screws behind coverings. ... To remove headlight switch, detach fuse panel (screws highlighted in ... Pull out and detach wires from the back. ...
    (uk.rec.cars.maintenance)
  • Re: Zenos Wallswitch (was Re: AKICIF: The limitations of compact fluorescent
    ... >>It is this type of lamp to which, I presume, Mark was referring. ... > compact-fluorescent bulb. ... > offer one brightness at some switch>position, ... pull string switch and a built-in heating element. ...
    (rec.arts.sf.fandom)
  • Re: Zenos Wallswitch (was Re: AKICIF: The limitations of compact fluorescent
    ... >>>It is this type of lamp to which, I presume, Mark was referring. ... >> offer one brightness at some switch>position, ... >pull string switch and a built-in heating element. ... >heater stays on. ...
    (rec.arts.sf.fandom)
  • Re: pin2k WTF
    ... My son and I get the playfield up, unscrew the switch, and promptly ... the screw directly under the driver board. ... So we pull the playfield... ...
    (rec.games.pinball)
  • pin2k WTF
    ... My son and I get the playfield up, unscrew the switch, and promptly ... the screw directly under the driver board. ... So we pull the playfield... ...
    (rec.games.pinball)