Creating an XOR gate

Discussion in 'General Electronics Chat' started by shaqywacky, Aug 16, 2010.

  1. shaqywacky

    Thread Starter Active Member

    Apr 1, 2009
    48
    0
    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.

    [​IMG]
    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.
     
  2. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    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.
     
    absf likes this.
  3. marshallf3

    Well-Known Member

    Jul 26, 2010
    2,358
    201
    absf likes this.
  4. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Another way. You didn't define logic type, so I used a hybrid of DTL.

    [​IMG]
     
    • XOR.GIF
      XOR.GIF
      File size:
      3.7 KB
      Views:
      937
    absf likes this.
  5. shaqywacky

    Thread Starter Active Member

    Apr 1, 2009
    48
    0
    @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.
     
  6. shaqywacky

    Thread Starter Active Member

    Apr 1, 2009
    48
    0
    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?
    [​IMG]

    Also, sorry for the double post, I can't edit the other one.
     
    Last edited: Aug 18, 2010
  7. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    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).

    [​IMG]

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

    An RTL AND gate...

    [​IMG]

    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.
     
    • NOR.GIF
      NOR.GIF
      File size:
      1.5 KB
      Views:
      841
    • AND.GIF
      AND.GIF
      File size:
      1.8 KB
      Views:
      824
    Last edited: Aug 18, 2010
    absf likes this.
  8. marshallf3

    Well-Known Member

    Jul 26, 2010
    2,358
    201
    DTL is far more practical since it better isolates the inputs.
     
  9. shaqywacky

    Thread Starter Active Member

    Apr 1, 2009
    48
    0
    @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?

    [​IMG]

    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.
     
  10. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Diode Logic is definitely worth learning, it will simplify many a schematic.

    [​IMG]

    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).
     
    • RTL.GIF
      RTL.GIF
      File size:
      5.9 KB
      Views:
      880
    Last edited: Aug 18, 2010
  11. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Try this for your next schematic. Remember that you can eliminate a resistor when coupling RTL logic together.

    [​IMG]

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

    New Member

    Sep 26, 2014
    1
    0
    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
     
Loading...