6
\$\begingroup\$

I'll preface this question by saying that I am a software developer just starting to learn the basics of electronics, so it's very likely I'm missing some fundamental intuition here.

Below is a mechanical NAND gate with two switches. I think it's supposed to be obvious that when the switches are closed, the output Q is 0 rather than 1. I don't see why this is.

I see that when the two switches are closed, there is a path from V+ to ground, and that current will flow to ground. But there's also a path from V+ to Q, so won't some current still flow to the output, putting it in a 1 state?

The intuition I'm using (which may be totally wrong) is this:

  • Current acts like water gushing from V+ down all available paths.
  • At a junction, current will flow through both paths in an amount inversely proportional to resistance. In this case, both paths have no additional resistance so they should split the current equally.
  • The boolean equivalent of a 1 is that current is flowing through a point.

Please help me understand what I'm missing! And if you can point me to a book or online resource explaining these fundamentals, that would be very helpful. I've tried looking at a lot of "circuit tutorial" content on Google, but surprisingly haven't been able to resolve my confusion here.

schematic diagram

\$\endgroup\$
  • \$\begingroup\$ The source impedance of the switch is 0 while in normal logic it is <=50 Ohms so the load impedance being much higher permits many loads to applied without significant change in voltage. For TTL, the limit was 10 units of load. But for static CMOS , the limit depends on the equivalent input capacitance and current limit of the switch as this affects rise/fall time. T=RC \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Apr 30 at 1:02
  • \$\begingroup\$ "I see that when the two switches are closed, there is a path from V+ to ground, and that current will flow to ground. But there's also a path from V+ to Q,". No, there is only 1 path, V+ to ground, Q is a point on that path. And, when the switches are closed, Q is at the same potential as ground. \$\endgroup\$ – Glen Yates Apr 30 at 15:13
15
\$\begingroup\$

The boolean equivalent of a 1 is that current is flowing through a point.

That's the fundamental confusion leading to difficulty in understanding the circuit.

Single ended logic like this encodes state as voltage not current.

Inputs of logic gates are designed to source or sink very little current, so the output of the previous stage is easily able to impose its intended voltage on the connection between output and the following input with very little current needing to flow.

Current-mode signaling does exist, but it's generally used only in noisy situations, for example the time-tested 4-20 mA current loop standard.

\$\endgroup\$
  • \$\begingroup\$ Gotcha. Can you explain why the voltage of Q is only positive when there is no path from V+ to ground? \$\endgroup\$ – rampatowl Apr 30 at 1:34
  • 2
    \$\begingroup\$ Because in a "tug of war" the low resistance switches win over the pulling resistor in imposing the voltage on their far side. \$\endgroup\$ – Chris Stratton Apr 30 at 1:46
  • \$\begingroup\$ Oh of course! So is the rule something like: to determine whether an input pin is high or low, look at every defined component it is connected to, and it will take on the value of the defined component with the least resistance along the path to that component? \$\endgroup\$ – rampatowl Apr 30 at 1:56
  • 3
    \$\begingroup\$ Approximately: but not just the components but what is behind them, in this case "stiff" voltage rails. And if the difference in resistances is not drastic then the voltage may end up intermediate. \$\endgroup\$ – Chris Stratton Apr 30 at 2:02
3
\$\begingroup\$

First off the "N" means that it inverts the input the schematic is sort of doing the same but it gets off track of how the gates work. If you drew it with a relay it would make more sense

schematic

simulate this circuit – Schematic created using CircuitLab

You need to study pull down and pull up resistors, the value of the resistor limits the voltage, current is not an issue really because this is all at "logic level". I had a hard time with the logic stuff at first and then all of a sudden it all made sense, good luck my friend.

\$\endgroup\$
2
\$\begingroup\$

I also had this problem since I started learning a bit about electronics (I'm also a software engineer).

Electricity always wants to balance. If there is GND, all electricity will flow to there (actually the electrons move in reverse direction but let's ignore that for now).

This means if the switches are closed, and if Q > 0 V, all electricity will flow to GND, meaning Q will be 0 V in a very short time (read: almost instantly).

However, when one of the switches is open, the voltage from V+ will flow to Q if Q has less voltage than V+ (which is likely so), so Q will end up having the same voltage as V+.

\$\endgroup\$
0
\$\begingroup\$

It is indeed a basic question but I think it is a very valid one. I am an electrical engineer and agree that it seems that the logic is broken but read on and you'll see how easy it is.

As it was answered before, electronic logic gates are named for its voltage behavior, but that's the easy part. Whenever both SW1 and SW2 are pressed (i.e. its value is "1"), the voltage in the point Q is "0". We can translate it to using logic gate symbols.

schematic

simulate this circuit – Schematic created using CircuitLab

The voltage at Q (i.e. Q to GND) is *Logic 0" when both buttons are pressed.

Now comes the not complicated but rather confusing part. Suppose you have the following circuit:

schematic

simulate this circuit

I'm sure you will say that's definitively an AND. But let's keep in mind the fact that the point Q voltage drops to 0 when both buttons are pressed and let's translate the circuit to using logic gates.

schematic

simulate this circuit

Now, you will see that the relay will turn on only when the point Q voltage drops to zero (i.e. when both buttons are pressed.) So, think it this way; if you were going to do your own physical implementation of this circuit with logic gates, you would have to buy a NAND. Now you have a Wired AND despite the fact that you are actually using a NAND gate. So don't worry, your computational logic is safe.

\$\endgroup\$
0
\$\begingroup\$

I found very useful the simple description of a NAND gate to act thusly "any zero in causes a one out". This circuit will do that.

In this circuit, if either switch is pressed, which causes a ZERO volts input to the inverter, then a logic HIGH appears out of the circuit.

Note we mixed logic 1 and logic HIGH and VDD and TRUE, along with logic 0 and FALSE and GROUND and logic LOW.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 2
    \$\begingroup\$ Looks like an 'OR' gate to me... but maybe I just don't understand how you intend for those switches to work (that's a problem with your answer -- you didn't even try to describe their behavior) \$\endgroup\$ – Ben Voigt Apr 30 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.