0

I am confused by this kind of diagram (simplest, NOT gate):

------1------___Gate Here___-------0--------

Because my book tends to talk about electricity.

So if I think of 1 as electricity, and 0 as not, then how can you have 1 (electricity) and 0 on the other side?

I now realize that the gate itself (if I am correct) is wired to a power supply of some kind.

But how would the explanation be, is 1 and 0 related to voltage instead? But how do you have no voltage in the output then? Is it more like the 1 is cancelling the flow of electricity? How?

JYelton
  • 32,302
  • 33
  • 134
  • 249
Mah Neh
  • 23
  • 5
  • Flow of electricity = current, and there is no practical current going into a gate. Think of a NOT gate as a guy with a multimeter on the input. If he measures voltage on the input, he leans over in 10 ns and adjusts the voltage source on the output to 0 V. Vice versa, measure no voltage on the input -> increase the voltage source to 3.3 or 5 V on the output. – winny Feb 23 '23 at 14:00
  • https://www.electronics-tutorials.ws/boolean/switching-theory.html – Sredni Vashtar Feb 23 '23 at 14:01
  • @winny amazing thank you, people talk so much about electricity that I didnt know there wasnt any flowing. It is more like a communication system where the 1 tells to put a 0, actually doing under the hood is doing what you describe. – Mah Neh Feb 23 '23 at 14:05
  • If you look at [Wikipedia's page](https://en.wikipedia.org/wiki/Inverter_(logic_gate)#Electronic_implementation) you'll notice that implementations all all connected to Vcc and GND (or equivalents) in addition to the input and output pins. The paragraph above the diagrams discusses the fact that depending on the implementation, there may be current flowing and wasted power. – jcaron Feb 23 '23 at 14:10
  • Well, I wrote a long answer, but the question got closed. Thanks a bunch. I disagree that the question is a duplicate, as indicated by the huge difference between my answer here, and my answer in the "duplicate". – Simon Fitch Feb 23 '23 at 16:57
  • 1
    The logic diagram is not a diagram of electricity just like the equation $a+b=c$ is not an equation of electricity. If you want to turn it *into* an electrical design, you have to add more parts. – user253751 Feb 23 '23 at 20:14

1 Answers1

1

1 (or "high") and 0 (or "low") are almost always referring to voltage, and in modern systems those voltages are 0V and 3.3V (or perhaps 5V). However that information is not enough to understand what's going on.

From your question it's clear that you don't have a grasp of what voltages are, how it's related to current, or anything really that can help here, but I can give you some pointers.

When we say "voltage" we are really talking about the difference in some property between two points in a circuit. A 9V battery, for instance, has a difference of 9V between its two terminals, which you can measure with a voltmeter.

However, that difference could mean that one terminal is at +1000V and the other is 9V higher than that, at +1009V. It's only a difference, and because of that, for convenience, we call one of them "zero volts" and refer to other terminal as +9V. It's like when I say I am 6 feet tall, I'm referring to the distance between my head and my feet.

If I then stand on a chair, 2 feet off the ground, am I now 8 feet tall? No, I'm still 6 feet tall.

So get this into your head, when someone says "ten volts", they are simply referring to a voltage relative to somewhere else in a circuit. They are simply saying that this point in the circuit has 10 more volts than this other point in the circuit. If we all agree on where we shall call "ground", or "zero volts", we know exactly what they mean.

So in the following circuit, the ground symbol is the little triangle at the bottom, and that is what I will call "zero volts". Everything else in the circuit will have some "voltage" relative to this zero-point. Everything connected to that point, with a wire, will also be zero volts, because that's what wires do - join things together to all be the at the same voltage:

schematic

simulate this circuit – Schematic created using CircuitLab

There are other nodes (wires) in that circuit, and other components, but the most important thing for now is to understand that the battery's job is to make the top left wire 9V higher in voltage than the wires connected to ground.

Now you know what the wire does, and the battery, we can introduce the switch. The switch is something that can connect two things together, like a wire does, or disconnect those two things from each other. With some imagination, it's possible to see how we can use switches to choose between voltages:

schematic

simulate this circuit

Firstly, note that everything connected to node A has voltage of +9V, relative to our designated ground (0V) node B. Similarly, everything connected to node B has a voltage of 0V.

In the box "GATE1", switch SW1 is open, and does not connect node P to node A, but the other switch, SW2, is closed, physically joining node P to node B. This connection brings the voltage of node P to same as node B, which is at 0V, as if it were connected with a wire. If we interpret +9V to mean a logic "high", and 0V as "low", then we can say that the output P of GATE1 is low.

By contrast, the output Q of GATE2 must be "high", because SW3 joins node Q to node A, at +9V relative to ground.

Bad things happen if SW1 and SW2 are closed simultaneously, or if SW3 and SW4 are closed simultaneously, so we must take care to avoid those conditions.

Now all this may seem obvious to you, or not, but here we have an example of boxes (gates) that are able to control the voltage of their outputs depending the states of switches inside them, and which derive their "high" and "low" output signal voltages from a separate, external power supply, the battery. In other words, they are able to provide "logic levels" to the outside world, purely by controlling which voltage their output terminals are physically connected to.

That model uses physical switches, but in real digital logic integrated circuits, the switches are replaced with transistors. However their behaviour is identical to the switches (at least for digital systems), in the sense that an open switch is simply an infinite electric resistance, and a closed switch is a resistance of zero ohms, functionally identical to a "wire". Instead of physically moving metallic contacts, the changes between the states of infinite and zero resistance is performed electronically.

Now extend the model to include circuitry that can detect what voltage is present at one or more input nodes, (again using transistors), and depending on their states (some combination of highs and lows), choose to set its own output voltage to high or low, as explained above. We are able to produce AND gates, OR gates, NOT gates (inverters) and any combination thereof quite easily, using transistors, and sometimes other components.

Just like above, digital logic ICs have two connections for 0V and +9V "supplies" (or more often +3.3V or +5.0V), outputs whose voltages are controlled by internal transistor switches, to perform the routing of those supply voltages to output pins, and input pins where we "apply" voltages which the internal circuitry interprets to choose which output switches are to be closed and which should be open.

That's how we use voltages to represent logic "high" and "low". I haven't mentioned electric current, or how transistors work, because it's all a vast topic, but that should get you started.

Edit: I realise I haven't explained what voltage means, what a "volt" is, because it's also a big topic. It's probably a topic for a physics forum.

Simon Fitch
  • 27,759
  • 2
  • 16
  • 87
  • I am reading it slowly. Thank you so much...I have one question, wouldnt electricity flow to the earth when you connect part of battery to it? – Mah Neh Feb 24 '23 at 10:25
  • Is this "Instead of physically moving metallic contacts, the changes between the states of infinite and zero resistance is performed electronically." about the voltage inside this npn or pnp transistors? – Mah Neh Feb 24 '23 at 10:36
  • @MahNeh Yeah, you're right, but I don't use the term "electricity flows", I would say "electric current flows". The phenomena of current and voltage are intimately related, where you have one, you have the other, even if the other is "zero". What relates them is resistance. All three are part of the thing we call "electricity", in the same way money, possessions and selling are all part of the thing we call the "economy". – Simon Fitch Feb 24 '23 at 11:18
  • @MahNeh Electronics is about the manipulation of electric charges, mainly electrons, the flow of which is call "current". Often this is about improve or reducing the ability for electric charges to travel. You can change this "resistance" to flow by physically joining/separating two metallic contacts, or you can do it the "solid state" way, by using the innate properties of materials and electric charges themselves, to alter charge mobility inside the material. Either way you achieve the same goal, which is to change electrical resistance to flow of charges (current). – Simon Fitch Feb 24 '23 at 11:30