Re: Constructing ab' with a NAND

Terry Pinnell wrote:

Method 2:
Invert b with NAND gate to give b', then AND(a,b') = 1 = Out with a
couple of diodes, like this:

Thank you, that method worked fine.

I do however have some questions. Using the schematic you posted, if I connect a LED between OUT and GND, the LED will light when a and b are high (this is expected, since the circuit is an AND).

Since this AND-gate is controlling a buzzer (alarm), I connected it to a transistor and the buzzer. If I dont use the transistor, it won't work because of too low current (I think).

So, I grabbed a BC547 NPN from my box, connected OUT to the base, buzzer red wire to +5 and buzzer black wire to the collector. The emitter I sent to ground. However, this circuit makes the buzzer buzz all the time, just as if there is always a current to the base of the transistor, completely regardless of the a and b inputs.

I'm by all means an utter novice to transistors, but the fact that the LED was off when either the a and b inputs to the AND was low made me think that there will be absolutely no current to OUT, and therefore the transistor should not let current flow through its collector and emitter, and therefore the buzzer should not buzz either.

Obviously, I'm thinking wrong somewhere but I can't figure it out.

-- Sincerely, | Rikard Bosnjakovic | Code chef - will cook for food ------------------------------------------------------------------------ .