AND/Logic Questions

Hi, I'm reletively familiar with electronics, and I'm trying to find some information regarding implementing logic into a circuit I want to build.

I am having trouble however actually learning how to actually USE an AND gate. The IC I am using is: 74LS08, a data sheet can be found at:

formatting link

It is a simple QUAD 2 Input AND Gate. However, when I try to use it, I am unable to make it work correctly. I am trying to use anywhere between 6-9Vdc. The circuit I use basically has two switches, one LED, and the IC. I have the IC hooked up to a positive and ground/negative of my power supply, and each switch is hooked up to pins 2 and 3 on the IC (the input gates of the logic switch), and they are hooked up on the other side to a positive voltage. The LED is connected to the output of the AND Gate. When both switches are on, the circuit is closed and the light is on, however when one switch is off, the light still stays on.

is there anything i am doing wrong? or does anyone have some websites that might help me? I have been googling this for a while but have had no luck.

thank's

trevor

Reply to
trevormcg
Loading thread data ...

Take a look at the first page of the data sheet. The supply voltage operating range is specified for 4.75 to 5.25 volts.

If you need a gate that operates up to 9 volts, you should look at the

4000 series CMOS family.

formatting link

Here is another problem. TTL gates are not high impedance voltage inputs, like CMOS gates are. They are current operated inputs. They contain an internal pull up current source (a resistor) and you have to suck that current to very near ground before the input sees a logic low input. Leaving the input open circuited allows that internal pull up to bias the input positive. So you have a logic high input whether your switches are open or closed.

Even if you use a CMOS gate, you will need to add a resistor to the switched inputs to pull the voltage the opposite way that the switch does, so there are no open circuit inputs at any time.

The LED is connected to the output of

You also need to make sure that the current to the LED is limited to a safe value for both the gate and the LED.

Reply to
John Popelish

--- There are several things you're doing wrong.

  1. The absolute maximum power supply and input voltage you're allowed to use is 7V, so if you're running higher than that, all bets are off. The recommended supply for LS is from 4.5 to 5.5V in order for the device to stay within its spec's, so with your supply cranked all the way down to 6V, if you put a diode in series with the positive lead that would drop the voltage down to about 5.3V which would be fine.

  1. With LS, a floating input (which is what you have when you turn either or both of the switches OFF) is automatically high, so since the inputs never go low the LED always stays on.

  2. The choice of an AND for this application is a bad one. Not your fault, since you're just learning, so here's why:

LSTTL was designed with outputs that can sink 8mA but can only source 400µA and still stay within their guaranteed switching levels. Likewise, LSTTL inputs need to be able to source 400µA to ground before they're considered to be at a logical zero.

What that means is that if you want to use the AND for your application, both inputs have to be pulled down to ground with somewhat less than 2000 ohm resistors in order for the inputs to be less than Vih (0.8V) while sourcing 400µA each.

Unfortunately, there's nothing you can do with the output except hook it up to the LED, since it can't source enough current to hurt the LED (well, maybe that's fortunate ;)

In any case, with an AND in there the circuit would look like this:

+6V>---[1N4001>]---+------+ | | | O | O S1| O S2| O | | | +--A | | & Y--[LED>]-+ +---------B | | | [R] [1K8] [1K8] | | | | GND>---------------+------+---------------+

A good choice of a gate for this application, if you want to show ANDedness by having the LED come on when S1 AND S2 were in the same state would be to use the DeMorgan equivalent of the AND, the OR, like this:

+6V>---[1N4001>]---+------+---------------+ | | | [10k] [10k] [R] | | | | +--A | | | & Y--[---------------+------+

That way, when S1 AND S2 are made the output of the OR will go low, turning on the LED using the gate's sinking capabilities.

-- John Fields Professional Circuit Designer

Reply to
John Fields

DeMorgan equivalent of the AND, the OR, like this:

+6V>---[1N4001>]---+------+---------------+ | | | [10k] [10k] [R] | | | | +--A | | | & Y--[---------------+------+

Oops...

Should read:

+6V>---[1N4001>]---+------+---------------+ | | | [10k] [10k] [R] | | _ | | +--A _ | | | _& Y--[---------------+------+
--
John Fields
Professional Circuit Designer
Reply to
John Fields

formatting link

the

the

of

1) Tie all unused gate inputs to ground or Vcc 2) Never allow an input pin to float (i.e. use a pull-down resistor {10K should be fine} on the input pins that you are tinkering with) 3) Always use a current limiting resistor when driving LEDs

Your chip could be latching up or it could be that the input pins have high enough impedance (like cmos devices) where the stored charge continues to look like a logic 1 even though you turn the switch off. A pull-down resistor will fix that.

Reply to
Anthony Fremont

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.