Go Down

### Topic: Using a simple AND gate ic (Read 1 time)previous topic - next topic

##### May 15, 2012, 06:14 pm
Im using the 74LS08 quad AND gate, in a simple circuit connecting it to a dip switches, but it doesnt seem to work, do i need pull up or pull down resistors and why?

#### michael_x

#1
##### May 15, 2012, 06:30 pm

do i need pull up or pull down resistors and why?

The dip switch is just an open/close switch, but the signal needs to be HIGH/LOW, not HIGH/undefined
So yes, you need a pulldown, if the swich supplies HIGH when on.

Any unused input pin of an AND gate has to be high, too.
Alternatively, you can supply a signal to more than one pin.

#2
##### May 15, 2012, 06:32 pm
thankyou, but what i dont understand is that if i dont connect my inputs to anything the gate takes that as a HIGH. so i have just connected the dip switch to ground without any resister and it is working fine.

#### michael_x

#3
##### May 15, 2012, 06:49 pmLast Edit: May 15, 2012, 06:58 pm by michael_x Reason: 1
from http://www.kpsec.freeuk.com/components/74series.htm regarding 74LS...

Quote
Inputs 'float' high to logic 1 if unconnected, but do not rely on this in a permanent (soldered) circuit because the inputs may pick up electrical noise. 1mA must be drawn out to hold inputs at logic 0. In a permanent circuit it is wise to connect any unused inputs to +Vs to ensure good immunity to noise.

For the 74HC.. series ( less power requirements in amount and regulation, slower ) pulling inputs is more important, I agree.

#4
##### May 15, 2012, 08:36 pm
can someone please help me to connect a 74LS08 quad and gate to a dip switch? I cant seem to understand how the pull up or pull down resistors work. i want the inputs to go to low when the switch is off and high when the switch is on.

#5
##### May 15, 2012, 08:59 pm
What kind of switch? Momentary On push button that is normally open?
3-pin toggle switch with normally open, common, normally closed pins?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#6
##### May 15, 2012, 09:01 pm
its a dip switch like this one:

#### Eriba

#7
##### May 15, 2012, 09:19 pm
This: http://en.wikipedia.org/wiki/AND_gate and this: http://en.wikipedia.org/wiki/Pull-up_resistor are good articles and should answer your question.
"Everything should be made as simple as possible, but no simpler."

#8
##### May 15, 2012, 09:45 pm
Lets assume that "Switch on" = switch is in the closed position (pins connected to each other).

In that case, you need a pulldown resistor from the pin to ground, one side of the switch connected to a pin, and the other side connected to +5V.
When the switch is on, the pin is connected to +5, and when the switch is off the pin is pulled low.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### MarkT

#9
##### May 16, 2012, 12:40 am
The 74LS series are TTL - they need pullups of around 1k or so on inputs to guarantee reading high and you MUST NOT connect inputs directly to 5V...
To pull down you need a hard pull-down (ie use a 1k pull-up to 5V and the switch to ground, not the other way round).

Also you have to use pull-ups on a TTL output when its driving a CMOS chip like the ATmega to guarantee that an output HIGH will be seen as HIGH (it will probably work most of the time without, but it is not guaranteed I believe).  TTL levels are not symmetric.

74HC series are the modern CMOS pin-for-pin equivalent, and pullups and pulldowns of 10k to 100k will work fine - avoid TTL if you can, its more expensive as well as slower, power-hungry and difficult to interface to.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### Nick Gammon

#10
##### May 16, 2012, 09:28 am

Please post technical questions on the forum, not by personal message. Thanks!

http://www.gammon.com.au/electronics

#### MarkT

#11
##### May 16, 2012, 11:32 am

can someone please help me to connect a 74LS08 quad and gate to a dip switch? I cant seem to understand how the pull up or pull down resistors work. i want the inputs to go to low when the switch is off and high when the switch is on.

That's not easily doable with TTL as I've mentioned - ideally use push-to-break rather than push-to-make switches, or else feed the switches through inverters.

The problem is that TTL inputs are not really rated for connecting to +5V except through a resistor - the breakdown voltage of the input transistor is only 5.5V (bit close for comfort).   The good news is that I've done a bit more research and the LS series of TTL is more robust in this respect, so you should be able to get away with it - the input transistors can handle upto 7V

You will need a pull-down resistor as low as about 680 ohms though, to pull the inputs properly low, 1k might be a bit too large.

[ and the standard caveat - 0.1uF ceramic decoupling capacitor for every logic chip ]

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up

Please enter a valid email to subscribe