# XOR gate... why my LEDs are on?

#### Mccbgg

Joined Jun 28, 2020
14
Hi,

I am working on this XOR gate :

Here is what I did (before adding the OR) :

Why my LEDs still ON?

They still receive 4mA, but aren’t they suppose to receive 0mA because of the 2 NOTs on left?

#### Attachments

• 197 KB Views: 0
• 237.9 KB Views: 0

#### jpanhalt

Joined Jan 18, 2008
10,065
What is the output of the top AND gate? 0 + 0 = 0
What is the output of the bottom AND gate? 1 + 1 = 1

Now look at the OR gate: 0 + 1 = 1

Is this homework?

#### ericgibbs

Joined Jan 29, 2010
10,447
hi,
Why do you have Base currents of 1.6Amps.?
E

#### Mccbgg

Joined Jun 28, 2020
14
Is this homework?
No it is a personnal goal. If I can make all the logic gates on simulator and on breadboards, and I still like electronics after this (lol) I will buy my oscilloscope, Rigol 1054z

#### Mccbgg

Joined Jun 28, 2020
14
hi,
Why do you have Base currents of 1.6Amps.?
E
Hmm because I am a beginner and I am not sure to know what I am doing lol Is this a correct answer? Haha Thank you for your help. What would be the better curent base? My 3ohms resistor is not enough?

#### ericgibbs

Joined Jan 29, 2010
10,447
hi Mc,
For Logic Gates you should use only milli-Amps of Base current, say between 1mA and 10mA.

As logic transistors usually are either On or Off, acting as a switch.

When using low Collector currents, in saturated mode allow a gain of 50 to 100.
This means also you can increase the values of the Collector resistors.

E

#### dl324

Joined Mar 30, 2015
11,230
They still receive 4mA, but aren’t they suppose to receive 0mA because of the 2 NOTs on left?
You didn't implement the AND gates correctly.

#### crutschow

Joined Mar 14, 2008
25,247
What would be the better curent base?
For good saturation of the transistor when on, the base current should be 5 to 10% of the collector current (forced Beta of 10 to 20).
Most BJT data sheets use a value of 10% for the ON saturation voltage test.

#### Mccbgg

Joined Jun 28, 2020
14
I realy want to undersdand application of the NOT gate on such circuit.

For now... I tried all your recommandations and it doesn't work. I still get current on the output.

#### Mccbgg

Joined Jun 28, 2020
14
You didn't implement the AND gates correctly.
Hi Denis! Do you have a suggestion?

#### jpanhalt

Joined Jan 18, 2008
10,065
I realy want to undersdand application of the NOT gate on such circuit.

For now... I tried all your recommandations and it doesn't work. I still get current on the output.
The logic diagram shows that the LED should be lit. REDO the symbolic logic, THEN try your simulation modified accordingly.

#### Mccbgg

Joined Jun 28, 2020
14
The logic diagram shows that the LED should be lit. REDO the symbolic logic, THEN try your simulation modified accordingly.
Lol Ok I got it. I showed you the wrong part of the video. But both of my switches were turned ON. Here is the good part :

#### Mccbgg

Joined Jun 28, 2020
14
My NOT gate works (0 A at the LED) :

But my NAND doesn't work. The LED still receive current. Do you think the simulator is wrong?

#### dl324

Joined Mar 30, 2015
11,230
Do you have a suggestion?
The top transistor in your AND gate is wired as a diode (Q2 in my schematic). You shouldn't have the LED and resistor on the emitter of the bottom transistor (Q3 in my schematic).

One AND gate with an inverter on the top input:

The resistor values could be tweaked to reduce base current, but it will work as is.

#### Alec_t

Joined Sep 17, 2013
11,502
But my NAND doesn't work. The LED still receive current. Do you think the simulator is wrong?
No. Transistors aren't perfect switches. Even when they're turned fully on, the collector-emitter voltage is non-zero. In your sim it's about 80mV for each transistor, which gives a perfectly reasonable 135mV across the pair. This drives a tiny current through the LED.