Creating an XOR gate

Thread Starter

shaqywacky

Joined Apr 1, 2009
48
I want to create a "simple" half adder and full adder circuit, so the first step I took was trying to create a xor gate.

I can easily create an AND, OR, and NOT gates, but when ever I combine them(give them the same inputs), I start getting problems that I, as very much a beginner to this, am completely enraged by.

I got a simulator and created a XOR gate and looked for the problem and I found it at two transistors. They both are given 0V yet they still let almost 3V through.

XOR diagram I used: http://www.sci.brook...ogic/combi.html

Heres how I have it set up.


Note: The resistors at 58K are really 390K, the program just doesn't update it right.

If you look at that, both inputs are open, but the light is still on, and much brighter than when only is open. On the transistor near the middle I set two probes(red and blue). At the bottom is the voltage of those probes. The blue probe is at almost 3V.

I'm probably missing some fundamental thing and I really do feel like I'm blindly stumbling around in this.
 

Ron H

Joined Apr 14, 2005
7,063
Your schematic has so many flaws that I don't know where to begin.
Attached is an RTL (Resistor-Transistor Logic) XOR that should work for you.

Replace the A and B voltage sources with switches to +9V, and a 100k resistor to ground on the other terminal of each switch.

I have included the .ASC file in case you or anyone else wants to simulate the circuit in LTspice.
 

Attachments

Thread Starter

shaqywacky

Joined Apr 1, 2009
48
@Ron H, Thank you very much. After studying your schematic for a while, I realized that I didn't really understand how to use transistors as switches correctly, I'm sure you already knew that.

You used the transistors as inverters every time except for the last one. Should that be the way I use them every time or did you just do that for the logic of the circuit? If the former, how would I create an AND gate. Double inverter?

@Bill_Marsden Its kind of funny, the way you posted for creating an xor gate was the first way I tried, but I had the same problem with here also. So I tried a new one.

Just for practice I'll try creating the way you posted also.

Thanks again guys.
 

Thread Starter

shaqywacky

Joined Apr 1, 2009
48
I messed around and made an AND gate the way I stated above but I feel like its a little too complicated. Is there a better way to do this?


Also, sorry for the double post, I can't edit the other one.
 
Last edited:

Wendy

Joined Mar 24, 2008
23,421
So you want to use RTL? Almost every logic family has a signature gate. The gate that is simplest to make with that family.

RTL's simplest gate is a NOR (after the inverter of course).



I prefer diode or DTL when making gates with discrete parts myself.

An RTL AND gate...



I notice your previous post uses simple switches. It would be more correct to use double pole switches, logic in general goes both to ground and to Vcc.
 

Attachments

Last edited:

Thread Starter

shaqywacky

Joined Apr 1, 2009
48
@Bill, I think I'll stick with RTL for now just because I understand it much more than DTL. I didn't even know there was something besides RTL until now. Thats why I didn't state which logic type I was using.

I'm not completely sure what you mean about the switch. Do you mean something like this?



Thanks for the better AND, It'll save me about $1 in resistors.

@marshallf3, I was reading about DTL and it really confuses me, so for now I'm going to stick with what I know more about.
 

Wendy

Joined Mar 24, 2008
23,421
Diode Logic is definitely worth learning, it will simplify many a schematic.



If you want to go through this with DTL (Diode Transistor Logic) I'll draw one up.

It is interesting to note that RTL's career was very short, as was DTL. Both have lousy noise immunity. TTL (Transistor Transistor Logic) lasted much longer, but it was replace with CMOS logic. CMOS is very power conservative and power supply voltage tolerant (it uses a wide range of power supply voltages). RTL used 3.3V, TTL used 5.0V ± .25V.

Diode Logic is useful, but it has elements of analog, which make putting gates after gates difficult (can be done though).
 

Attachments

Last edited:

Wendy

Joined Mar 24, 2008
23,421
Try this for your next schematic. Remember that you can eliminate a resistor when coupling RTL logic together.



Since NOR is the simplest gate for RTL this will make the same logic with lots fewer parts.
 

Attachments

i use this XOR gate schematic when building out of discrete components. I should point out that i always use 2N7000 MOSFETS and all of the diodes are general purpose and it uses a 5v supply.
xorGate.jpeg
 
Top