The most versatile logic gate? - Page 1
Forum section: electronics / beginners

author: Zero999
author_rank: Super Contributor
timestamp: October 03, 2010, 09:13:21 pm
content: My vote would go for the NOT gate because it can be made into a NAND, AND, NOR, OR gate, Schmitt trigger by just by adding resistors and it makes a nice oscillator by adding a capacitor.Attached are some examples. I've deliberately omitted the really obvious ones such as the astable, monostable, bistable and Schmitt trigger (see the (N)AND/(N)OR gate for that) and decided to give some circuits, I've not seen very often.

author: DJPhil
author_rank: Frequent Contributor
timestamp: October 03, 2010, 10:07:53 pm
content: Good call, I'd have to agree.Before I looked at the picture I was thinking, "Have I seen a NOT gate package? I don't remember that one!"Then I realized that everything I'd been reading was referring to them as inverters. Duh!

author: EEVblog
author_rank: Unknown
timestamp: October 03, 2010, 11:21:28 pm
content: If you have to add external passives then it's not really the most versatile gate IMO.The NAND is widely regarded as the most versatile gate.Remember, the NAND is a NOT gate too, just tie one input high (or together). But you only get 4 NAND's per package compared to 6 inverters.Dave.

author: Zad
author_rank: Super Contributor
timestamp: October 04, 2010, 02:04:24 am
content: NAND. Always has been, always will be. Sure you can get 6 inverters in a 14 pin package, but if you want it to do anything else you have to use 2 gates and additional passives.

author: Simon
author_rank: Unknown
timestamp: October 04, 2010, 06:54:01 am
content: I seem to remember from what little they did bother to teach us in school that you can use nands as your "universal" and on large circuits you can then simplify it, for example if you made two gates from nands and then joined them together you will often find that you have the output nand of one gate is setup as a not and the input nand of another gate is setup as a not. and because the negative of a negative is the original positive you can remove both, so really unless your using one gate only it can pay to work with nand equivalents as you may well still end up using just a few gates more

author: RayJones
author_rank: Frequent Contributor
timestamp: October 04, 2010, 06:54:51 am
content: NAND FTW.The NAND gate was *the* fundamental building block of most TTL logic, and if I recall all those years ago back in college we studied the actual equivalent circuit as in the 7400.The 00 also suggests the basis of the TTL genome.With a box of NAND gates you should be able to build anything, power supply permitting!

author: Zero999
author_rank: Super Contributor
timestamp: October 04, 2010, 07:58:11 am
content: I had a feeling everyone would talking about the NAND being king because that's what they were taught at school but they don't teach and useful NOT gate hacks at school.Quote from: Zad on October 04, 2010, 02:04:24 amThe NOR gate is just as good as the NAND and can be used to make any other gate, just like the NAND.Don't like having to use two gates? You could use a Schmitt trigger and use one gate. After all the above circuits are just Schmitt triggers created with feedback resistors.Of course a non-inverting gate can be also be used instead of two gates in the above circuits (apart from the ON/OFF button) but you don't get the NOT function so it's only any good if you have a quad OR but want an a AND, vice versa, or you need a Schmitt buffer.The ON/OFF switch can also form a poor man's divide by two counter by replacing the switch with a transistor but note that the base emitter junction is reverse biased when the input is low, so a diode needs to be connected in series with the base if the supply voltage exceeds double the maximum VBErating.

author: thakidd
author_rank: Regular Contributor
timestamp: October 04, 2010, 08:05:30 am
content: I agree that NAND and NOT are awesome...however, the bigger question is what are your design requirements? I personally think this is the most important question one might ask of a gate. There are negatives and positives to all gate approaches.

author: Zero999
author_rank: Super Contributor
timestamp: October 04, 2010, 08:34:02 am
content: Yes, adding resistors will increase the power dissipation and increase the propagation delay which will reduce the maximum usable frequency so these hacks aren't suitable for all applications. But using many NAND/NOR gates also slows things down, as well as requiring more ICs so it's hardly ideal.

author: thakidd
author_rank: Regular Contributor
timestamp: October 04, 2010, 08:37:14 am
content: i concur Hero

author: Zero999
author_rank: Super Contributor
timestamp: October 04, 2010, 08:39:10 am
content: Here's another idea showing how to build a poor man's analogue comparator with some NOT gates - I've tested this circuit with the quad CD4011 NAND and it worked surprisingly well.

author: scrat
author_rank: Frequent Contributor
timestamp: October 04, 2010, 11:07:41 am
content: Quote from: Hero999 on October 04, 2010, 07:58:11 amThat's surely true, due to De Morgan's laws! However, I think that NAND gates have become more popular due to the fact that the usual way of reasoning on truth functions is with sum of products (mostly we start from finding when outputs have to be true, not the opposite). So you have to implement a lot of ANDs, which result in the NAND to be more "useful" than NOR (which requires a logic gate more to make an AND).Among the many strange uses of NOT gates... A TTL NOT gate can become a small voltage amplifier, since it is a push-pull inverting amplifier, indeed.

author: Zero999
author_rank: Super Contributor
timestamp: October 04, 2010, 11:41:36 am
content: Quote from: scrat on October 04, 2010, 11:07:41 amSame for CMOS but you need to beware that the output stage is biased in class A so it will draw more current. I know that this is fine for the CD4xxxx series because the output current is low but it might be a problem for the 74HCxxxx series as the current could be too high. I'll have to experiment with this.

author: Simon
author_rank: Unknown
timestamp: October 04, 2010, 11:42:30 am
content: Quote from: Hero999 on October 04, 2010, 08:34:02 amso if you design in solid NAND and then apply the available reduction rules you will surely end up with a faster system that potentially needs no external parts and uses no more gates

author: Zero999
author_rank: Super Contributor
timestamp: October 04, 2010, 12:02:13 pm
content: Quote from: Simon on October 04, 2010, 11:42:30 amWhat do you think?EDIT:I mean I don't think you've given it enough thought.Which is most effective, depends on the design, do some examples for yourself and see.

author: Simon
author_rank: Unknown
timestamp: October 04, 2010, 06:26:51 pm
content: uh logic gates what are they ?Can't think of any examples but remember been shown in school how whole "circuits" could be reduced to just a single IC. When you design in equivalent NANDs and then look at the circuit as a whole forgetting the gates you emulated you will find that many can be taken out, the most classic being the output of one "gate" is noted and the input of the gate it connects to in also noted so 2 gates dissapere.of course if you have a limited little application where speed is not an issue you could use your nots and the resistors

author: Simon
author_rank: Unknown
timestamp: October 05, 2010, 06:47:25 am
content: Well this discussion is mostly academic I think, your solution works for single gate replacements or simple thing but ultimately is more expensive and take up more space than a couple of NAND IC's

author: Zero999
author_rank: Super Contributor
timestamp: October 05, 2010, 08:52:53 am
content: Quote from: Simon on October 04, 2010, 06:26:51 pmThis is the problem with school is you learn don't learn much about the real world.It's pretty obvious when you think about it. For a start there are six gates in a 74HC14 Schmitt trigger IC, which means you can save an IC just using resistors alone, even if you only want five NAND gates but what if you want an AND gate and an OR gate?The two universal gate types are NAND and NOR.With NAND gates, you'll need four for the OR and two for the AND.With NOR, you'll need four for the NAND and two for the OR.Either way, it's six gates, two ICs in total.The cheapest solution is to get one quad OR IC and make the AND with resistors or you could get a AND IC and make the OR with resistors. The gate capacitance and high/low voltage of logic ICs can be found on the datasheet so the additional propagation delay can be calculated:Take the 74HC00 for example:http://www.nxp.com/documents/data_sheet/74HC_HCT00.pdfC = 3.5pFR = 100kTypical high/low voltages with 4.5V supply:VH= 2.4VVL= 2.1V% charge on the input capacitance when charging and discharging from either supply rail to VHand VLrespectively.VH/Vs = 2.4/4.5 = 53.33%(Vs - VL)/Vs = (4.5-2.1)/4.5 = 2.4/4.5 = 53.33%That makes sense, the high and low voltages are biased around half the supply voltage, go 3.33% above and it's high and 3.33% below and it's low.From the RC circuit formula.http://en.wikipedia.org/wiki/RC_circuitt = RC*ln(1-%charge)Remember we've already don't need vCor Vin since it's just the ratio that's important and we've already got that, it's 53.55%RC = -350*10-9st = 350*10-9*ln(1-0.5333) = 266.7*10-9s = 266.7nsOf course this is much slower than the 23ns listed on the datasheet but it won't matter at low frequencies (below a couple of MHz) and if the resistors are reduced to 1k the delay only 2.67ns extra but disadvantage is the current will be higher.The current consumption:The tiny current consumption of the gates can be ignored. When both inputs are high the resistance will be 150k 4.5/150k = 30µAQuote from: Simon on October 05, 2010, 06:47:25 amNo, resistors are cheap compared to IC, check out the prices in RS, Farnel etc.