Author Topic: The most versatile logic gate?  (Read 9477 times)

0 Members and 1 Guest are viewing this topic.

Online Zero999Topic starter

  • Super Contributor
  • ***
  • Posts: 19493
  • Country: gb
  • 0999
The most versatile logic gate?
« on: October 03, 2010, 09:13:21 pm »
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.

 

Offline DJPhil

  • Frequent Contributor
  • **
  • Posts: 511
  • Country: 00
Re: The most versatile logic gate?
« Reply #1 on: October 03, 2010, 10:07:53 pm »
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!  :-X
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: The most versatile logic gate?
« Reply #2 on: October 03, 2010, 11:21:28 pm »
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.
 

Offline Zad

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: gb
    • Digital Wizardry, Analogue Alchemy, Software Sorcery
Re: The most versatile logic gate?
« Reply #3 on: October 04, 2010, 02:04:24 am »
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.

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: The most versatile logic gate?
« Reply #4 on: October 04, 2010, 06:54:01 am »
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
 

Offline RayJones

  • Frequent Contributor
  • **
  • Posts: 490
    • Personal Website
Re: The most versatile logic gate?
« Reply #5 on: October 04, 2010, 06:54:51 am »
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!
 

Online Zero999Topic starter

  • Super Contributor
  • ***
  • Posts: 19493
  • Country: gb
  • 0999
Re: The most versatile logic gate?
« Reply #6 on: October 04, 2010, 07:58:11 am »
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.

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.
The 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 VBE rating.
 

Offline thakidd

  • Regular Contributor
  • *
  • Posts: 56
Re: The most versatile logic gate?
« Reply #7 on: October 04, 2010, 08:05:30 am »
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.
 

Online Zero999Topic starter

  • Super Contributor
  • ***
  • Posts: 19493
  • Country: gb
  • 0999
Re: The most versatile logic gate?
« Reply #8 on: October 04, 2010, 08:34:02 am »
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.
« Last Edit: October 04, 2010, 08:38:02 am by Hero999 »
 

Offline thakidd

  • Regular Contributor
  • *
  • Posts: 56
Re: The most versatile logic gate?
« Reply #9 on: October 04, 2010, 08:37:14 am »
i concur Hero
 

Online Zero999Topic starter

  • Super Contributor
  • ***
  • Posts: 19493
  • Country: gb
  • 0999
Re: The most versatile logic gate?
« Reply #10 on: October 04, 2010, 08:39:10 am »
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.
 

Offline scrat

  • Frequent Contributor
  • **
  • Posts: 608
  • Country: it
Re: The most versatile logic gate?
« Reply #11 on: October 04, 2010, 11:07:41 am »
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.

Many times I appreciated your ability to make anything with logic gates.
It's a good exercise of creativity and require deep understanding of how the real gate works, but, IMHO, when trying to make something really reliable one can't use all of those hacks, until there is no other chance.
I think this kind of things could be useful for people starting to understand electronics, and I'm scared at this time electronics studying can become programming. People who are going to university (at least at mine) without having a prior knowledge on electronics from techical school, will have a good theoretical basis, but are out from some of these practical concerns, and so their older colleagues will make fun of them because they don't know what a 74xx, 40xx or 54xx is.

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.
The NOR gate is just as good as the NAND and can be used to make any other gate, just like the NAND.
That'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.
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. - Elbert Hubbard
 

Online Zero999Topic starter

  • Super Contributor
  • ***
  • Posts: 19493
  • Country: gb
  • 0999
Re: The most versatile logic gate?
« Reply #12 on: October 04, 2010, 11:41:36 am »
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.
Same 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.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: The most versatile logic gate?
« Reply #13 on: October 04, 2010, 11:42:30 am »
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.

so 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
 

Online Zero999Topic starter

  • Super Contributor
  • ***
  • Posts: 19493
  • Country: gb
  • 0999
Re: The most versatile logic gate?
« Reply #14 on: October 04, 2010, 12:02:13 pm »
so 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
What 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.
« Last Edit: October 04, 2010, 12:06:12 pm by Hero999 »
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: The most versatile logic gate?
« Reply #15 on: October 04, 2010, 06:26:51 pm »
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
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: The most versatile logic gate?
« Reply #16 on: October 05, 2010, 06:47:25 am »
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
 

Online Zero999Topic starter

  • Super Contributor
  • ***
  • Posts: 19493
  • Country: gb
  • 0999
Re: The most versatile logic gate?
« Reply #17 on: October 05, 2010, 08:52:53 am »
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

This 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.pdf
C = 3.5pF
R = 100k

Typical high/low voltages with 4.5V supply:
VH = 2.4V
VL = 2.1V

% charge on the input capacitance when charging and discharging from either supply rail to VH and VL respectively.
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_circuit

t = RC*ln(1-%charge)
Remember we've already don't need vC or Vin since it's just the ratio that's important and we've already got that, it's 53.55%

RC = -350*10-9s

t = 350*10-9*ln(1-0.5333) = 266.7*10-9s = 266.7ns

Of 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µA

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
No, resistors are cheap compared to IC, check out the prices in RS, Farnel etc.

« Last Edit: October 05, 2010, 09:19:53 am by Hero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf