# Understanding NAND

Regarding transistor circuits, I can see how the output of AND circuit works, but I'm not seeing how/why closing both switches turns the NAND circuit off (output above series transistors). Please lend some insight. Thanks.

Output only goes LOW if both inputs are HIGH. Both transistors need to be turned on. INs AND NAND 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0

Depending on the Vce of the transistors, that LOW could be as much as 1 to 1.4V. Have to be careful about mixing technology types.

but I'm not seeing how/why closing both switches turns the NAND circuit off

If both transistors are turned on, the the output is effectively connected to ground so the output is low or a logic zero. I would not call that off but you could make a case for calling it that. In my mind the output is actively sinking current.

If one of both transistors are off the output is connected to 5V ( through R3 ).

Logic signals are 1/0 true/false, high/low, active/inactive. On and off is perhaps confusing in this context, unless its some output device like an LED. On/off usually applies to current flowing, most logic families are voltage-level defined.

Grumpy_Mike: If both transistors are turned on, the the output is effectively connected to ground so the output is low or a logic zero.

Please explain how if both transistors are turned on, the output goes to ground. That's the part I'm not understanding. Thanks.

And if you think of it as one transistor?

If the transistor is turned on (aka, on A or B there is a voltage) then there is a path through the transistor which leads to GND.

A transistor can be thought of as a switch. When a little current flows through the base a lot of current can flow between the collector and emitter. So the emitter and collector can be thought as being connected together like a switch. So when a transistor is on the collector is connected to the emitter and the emitter is connected to ground. So anything connected to the emitter is also connected to ground.

The transistors are either in cutoff or saturation when used as a switch, neither is much to do
with normal transistor action as used in amplifying a signal, which happens in the active region.
Think of it as a mechnical switch controlled by the base current being present or absent.

This is the equivalent circuit with switches. The switches are closed when current is applied to them.
The flashlight bulb only light up when both switches are closed.

Thanks for replies and good to be reminded transistors can work as switches. Grumpy Like, following that example with both switches closed = light on, in 2 transistor example, why does all voltage run to ground and not power led when circuit is closed? In my thinking the voltage should hit the light even before it gets to transistors, unless closing 2 switches blocks ground, which does not seem to be the case.

The light being ahead of the transistors seems to be a key factor here that I'm not getting. Thanks for more explanation.

The light being ahead of the transistors seems to be a key factor here that I’m not getting.

If you are thinking that the order of the components matter in a series circuit then you are not getting to grips with how electricity works.

A circuit has to be considered as a whole electricity does not hit anything first.

why does all voltage run to ground and not power led when circuit is closed?

What circuit are we talking about here, that last one of mine or your original one.
For mine
The circuit is from the battery positive, through the flash lamp thus lighting it up, through one switch, through the other switch and then to the battery negative.

For the original one there is no LED in it and I don’t know where you have it connected, but with both transistors on the current goes to ground and the voltage on the collector of the top transistor is at ground. So an LED connected from the top transistor’s collector to ground will have no voltage across it and so will not light up.
However if the LED were connected to the collector of the top transistor and to 5V then when that collector was connected to ground the LED would light up.

There are two ways to control an LED the first is called sourcing current and the second is called sinking current
Note all LEDs must also have a series resistor. That is why I draw a flashlight bulb to make things simple.

Note to everyone except the OP. I am simplifying this by assuming that Vsat is zero, it isn’t but that fact doesn’t matter at this stage in the argument.

Why is the output above the transistors in a NAND circuit, and below the transistors in AND circuit?

Does this help?

p1ne: Why is the output above the transistors in a NAND circuit, and below the transistors in AND circuit?

I think its time to try this out on paper, figuring out what combinations of inputs causes the output to be high or low. Worth looking add wired-and and wired-or diode-resistor circuits too.

and below the transistors in AND circuit?

It's not.

Check Crossroads diagrams. NAND output is above transistors and AND output is below. More examples attached.

Check Crossroads diagrams.

OK.

No special reason it is just the way it is implemented. It is the simplest implementation using the fewest transistors but there is nothing significant about the positioning.

Understand that the circuits you are showing are simplified, not-very-good, logic gates. In order to understand them, you should assume that the transistors are perfect switches: an NPN transistor is turned on by a positive voltage (logic 1, usually), and a PNP is turned on by a GND voltage (logic 0) Um. That means I have doubts that the PNP circuit you showed actually implements an AND gate. Looks to me like the output will only be 1 if both inputs are 0 (which makes it a NOR gate.) Similar circuits (http://hyperphysics.phy-astr.gsu.edu/hbase/Electronic/and.html) make an AND gate with similar topology and NPN transistors... (As in your second link)

Thanks to all for weighing in. A key point to my understanding has come about with learning that electrons in a closed circuit flow opposite the arrow symbol on the transistor.

So wiith NAND 2 NPN transistor circuit with LED and 2 normally open switches, cathode is to ground with anode connected to collector/voltage in (via resistor). So the circuit is already closed, and the LED is on. The open switches have no bearing, nor does 1 closed switch.

However, when both switches are closed, a flood of electrons goes to the LED anode, essentially creating 2 grounds on the LED and the light goes off.

My previous confusion about why the output LED was "above" or "below" the transistors had to do with not understanding the difference of connecting the output to the collector vs. the emitter: unlike the NAND circuit where voltage is already being supplied to the output/LED, when the output is connected to emitter, no voltage is flowing through the transistor when both bases are open.