Op amp AND logic gate

Thread Starter

Synopsis

Joined Oct 20, 2009
3
Hi,

Can you make a AND logic gate using two op amps? (I have seen a circuit for an AND gate using one op amp however the main AND function was being performed by the two diodes on the input to the noninverting terminal).
 

MikeML

Joined Oct 2, 2009
5,444
You can do it with comparators because they are "open collector", and you can do logic by wiring their outputs together and sharing a pull-up. OpAmps have push-pull outputs, so you must use diodes for isolation, either on the inputs or outputs.

Another way. Tie two equal resistors from each logic input to the non-inverting input of a comparator. Feed the inverting input with a reference voltage which is 3/4 of the High Logic Level. The only time the comparator output will be high is if both logic inputs are High. If either is low, the non-inverting input will be at 1/2 Vh.
 

Wendy

Joined Mar 24, 2008
23,429
Nice one Mike, I knew this, but did make the connection the OP.

I use diodes a lot for one or two gates, more than that I go with a logic family.
 

Thread Starter

Synopsis

Joined Oct 20, 2009
3
Ok, stupid question maybe, but any op amp can be used as a comparator right? like the LM324 which I need to use, can you perhaps elaborate with a circuit diagram please? What I am basically wanting to achieve is to minimize the number of components being used and therefore replacing two transistors (to make a AND gate) and use the one or two op amps I have left on the LM324 package as I am only using two.
 

Wendy

Joined Mar 24, 2008
23,429
Nope. A comparitor has a digital output, it can be a 1 or a 0. An op amp is a linear device. Under certain circumstances a op amp can be used as a comparitor (it will never be a good one), but a comparitor can never be a op amp with a linear output.
 

russ_hensel

Joined Jan 11, 2009
825
You can do it with one op amp. Set up as an adder. Set to high gain ( very high, sor of makes it a comparitor ) Bias to produce 0 output with either no or 1 input positive, and with V+ output for both inputs positive. There are several variations depending on which inputs you use, where you apply the bias, and there is the option of adding a bit of positive feedback. Calculation of values is left as an exercise. Output does not need to be open collector ( and use a rail to rail op amp with a single ended power supply )
 

Ron H

Joined Apr 14, 2005
7,063
You can do it with one op amp. Set up as an adder. Set to high gain ( very high, sor of makes it a comparitor ) Bias to produce 0 output with either no or 1 input positive, and with V+ output for both inputs positive. There are several variations depending on which inputs you use, where you apply the bias, and there is the option of adding a bit of positive feedback. Calculation of values is left as an exercise. Output does not need to be open collector ( and use a rail to rail op amp with a single ended power supply )
But it requires 4 resistors. A simple AND gate can be made with 2 diodes and a resistor. Cheaper, in terms of component count. The only down side is you get a crappy logic "0" level. With the LM324 and 4 resistors, you get a crappy logic "1" level.
 

russ_hensel

Joined Jan 11, 2009
825
But it requires 4 resistors. A simple AND gate can be made with 2 diodes and a resistor. Cheaper, in terms of component count. The only down side is you get a crappy logic "0" level. With the LM324 and 4 resistors, you get a crappy logic "1" level.
Your right it sucks, but I was just trying to answer the question as asked ( but I gues you could do it the other way and just add the op amps to do nothing )
 

SgtWookie

Joined Jul 17, 2007
22,230
It's a question of using the right tool for the job.

The LM324 isn't too awful as a low-power single-supply quad opamp goes.
But it really doesn't "cut the mustard" as a logic gate. Unless you like pounding in screws with a hammer.

MAYBE for very low-speed logic, it could be made to work in a very "iffy" way. You'd have better luck finding a '57 Chevy for under a grand.
 
Top