# Embarrassing electronics problem (logic gates)

 P: 32 Hi, I'm fairly new to and not very good at electronics (my A-level project was an LDR that turned on a light, LOL, and I got an A! {UK education for you}) and was wondering how the basic logic gates work. From hyperphysics this is an AND gate: Here's how I understand this Transistors work by producing one output iff there are two active inputs. So a current flows through A as well as the 6V voltage source, this produces an output that flows to the next transistor which, along with an active B - will produce an output in "out", assuming the ratios of the resistances are all accurate (and whatever parameters a transistor has). If I am accurate with this then a simple acknowledgement would be great with any relevant refinements or elaborations. Here's another AND gate. Here's how I understand this I don't. Diodes only allow current in one direction so how could this ever produce any output? Or does this work because diodes are imperfect and after a certain threshold voltage they will both allow a current. If so it seems strange that anyone would use this as the diodes are being used somewhat against their intended purpose. If you are willing could you please clear up all of my uncertainties? Would be greatly appreciated
HW Helper
Thanks
P: 5,455
Hi wannab,

 Quote by wannab Transistors work by producing one output iff there are two active inputs. So a current flows through A as well as the 6V voltage source, this produces an output that flows to the next transistor which, along with an active B - will produce an output in "out", assuming the ratios of the resistances are all accurate (and whatever parameters a transistor has). If I am accurate with this then a simple acknowledgement would be great with any relevant refinements or elaborations.
Yes, that explanation is adequate (just) and works for this circuit.

 Here's another AND gate. Here's how I understand this I don't. Diodes only allow current in one direction so how could this ever produce any output? Or does this work because diodes are imperfect and after a certain threshold voltage they will both allow a current. If so it seems strange that anyone would use this as the diodes are being used someone against their intended purpose.
What's labelled V is supposed to be a constant supply voltage, say +6V. When you apply 0V to the input at one of the diodes, what is the voltage at "out"? When you apply +6V to both diode inputs, what is the voltage at "out"?
 P: 102 Try to look at the diodes as switches. When they conduct they are closed switches. If you use two level of voltage, 0 volts and V volts, you can get the diodes to conduct when you apply 0 volts to the corresponding terminal. You then have direct connection to 0 volt potential, that is mass. Output is 0 volts (if the diode is ideal) and resistor R is dissipating the power in the form of heat. This happens if at least one diode is conducting. If neither diode is conducting, i.e. their input a both high, no current is flowing through R, hence no voltage can drop across it, and the output is V volts, i.e. high.
 Sci Advisor PF Gold P: 3,732 Embarrassing electronics problem (logic gates) Great question. I'll just try to add a teeny point to what's been said already. You'll find it helpful, i think, to imagine yourself very small and inside the circuit, 'feeling" the voltages tug at you as if you were a charge carrier. In your second example imagine yourself sitting at the bottom of that resistor. That's the node of R, OUT, and the two diode anodes. You feel the V+ pulling UP through the resistor, that's why it is called a "pullup resistor", and you feel nothing through the diodes as shown because there's nothing on other side of them to "pull down". IF you tie either diode to low, then you would feel that pull and it will overwhelm the V+ because the diode can pass more current than the resistor. Output will then be low. So your second circuit is an AND, ie to have high output both inputs must be not low but high. It is useful to accustom yourself to this kind of simple analysis. That is because some systems define TRUE as HIGH, others define TRUE as LOW. THAT gets confusing, especially when designers mix high-true and low-true in the same logic system. You need to be able to fall back on your basic circuit analysis. Keep up the good work . old jim
P: 32
 What's labelled V is supposed to be a constant supply voltage, say +6V. When you apply 0V to the input at one of the diodes, what is the voltage at "out"? When you apply +6V to both diode inputs, what is the voltage at "out"?
Surely it doesn't matter because the diode is blocking the current? I'm confused. To me this looks like it will always give an output as the 6V goes straight to the output before meeting the diodes.
P: 2,251
 Quote by wannab Surely it doesn't matter because the diode is blocking the current? I'm confused. To me this looks like it will always give an output as the 6V goes straight to the output before meeting the diodes.

the diode connected to A will not be blocking if the input to terminal A is low. that diode will then conduct. same for B.
P: 102
 Quote by wannab Surely it doesn't matter because the diode is blocking the current? I'm confused. To me this looks like it will always give an output as the 6V goes straight to the output before meeting the diodes.
That would be true if there were not a resistor in between. The role of the resistor is to "drop the voltage to zero" when the diodes are conducting.
Again, I am assuming ideal diode behavior here.

Try redraw the circuit using a closed switch connected to earth for D1, and an open switch (also connected to earth, but that's immaterial) for D2. What you see is just a resistor connected between +V and earth, and your output connected to earth. That is output voltage is earth's voltage.
P: 32
 Quote by rbj the diode connected to A will not be blocking if the input to terminal A is low. that diode will then conduct. same for B.
Why? I thought (at least ideal) diodes blocked all current? Or is it like I said before that it works because diodes aren't ideal?

Also why is there a disconnected ground in the picture? What's that supposed to mean?
 P: 410 Well, I think that you should back to basics. And try analysis this circuit Attached Thumbnails
 P: 32 I hate diodes. Do I have to understand them or can I just do everything with transistors?
 P: 410 In this Diode AND gate circuit we force both A and B into HIGH state. We have this situation Both diodes are "OFF". No current flows through R1 resistor. If no current flow through resistor, there is no voltage drop across resistor. So the output voltage is in HIGH state (10V). But if for example we have A input at HIGH state and B input at LOW state. D2 diode is forward bias. So there must be a current flow through R1 resistor. So the Output is at LOW state (0.6V - D2 diode forward voltage drop). Attached Thumbnails
P: 410
 Quote by wannab I hate diodes. Do I have to understand them or can I just do everything with transistors?
How can you understand transistor circuit if you don't understand how diode work?
And base-emitter junction is just a diode (PN junction).

Diode allows current to flow in one direction (called the diode's forward direction), while blocking current in the opposite direction (the reverse direction).

Only small reverse current will flow and this current is essentially constant no matter what reverse bias is applied. If reverse bis voltage increased sufficiently beyond reverse breakdown voltage. Diode will begin to pass a large reverse current which can destroy the diode.
Forward-biased diode ( the diode is ON)

Reverse-biased diode (diode is OFF)
P: 32
 Quote by Jony130 How can you understand transistor circuit if you don't understand how diode work?
I don't know, but all the pictures involving diodes in this thread don't make any sense to me.
 P: 32 Why don't they just show the transistor AND gate like this? It's like they're making it confusing on purpose.
 P: 410 They do that because this circuit will work in real life. http://hyperphysics.phy-astr.gsu.edu...etron/and4.gif . And circuit that you have drew, show only the concept not real working circuit.
 PF Gold P: 389 Transistors are created from multiple PN junctions, which is what a diode is. There is voltage at the output when the diodes are both reversed biased. Which will happen if both A and B are high. If either A or B is low a diode conducts, if they are both low both will conduct. But it only takes one diode conducting to "steer" current left and there is less voltage available at the output than Vout(1) (that voltage which corresponds to a logic high). So - if either of the inputs is low, current is steered left through that diode to ground, there is not adequate voltage at the output to correspond to a logic high.
HW Helper
Thanks
P: 5,455
 Quote by wannab it's like they're making it confusing on purpose.
...
P: 102
 Quote by wannab I don't know, but all the pictures involving diodes in this thread don't make any sense to me.
Have you even tried to replace the diodes with switches?
Because it looks like you are experiencing problems with basic circuit theory, not diodes.

In logic gates like the one you've shown here, diodes and transistors are nothing more than controlled switches. Transistors can act as closed or open switches by providing a suitable base or gate voltage. Diodes can act as closed or open switches by providing a suitable voltage at the 'gate input' terminal (if Vanode>Vcathode then it's a closed switch, otherwise it's open).

Once you understood how the gate works with ideal devices, you can refine your analysis by considering the effects of real devices (like diode drop voltage, internal resistances, parasitic capacitances...).

 Related Discussions Electrical Engineering 6 Engineering, Comp Sci, & Technology Homework 11 Engineering, Comp Sci, & Technology Homework 40 Introductory Physics Homework 2 Introductory Physics Homework 11