Maker Pro
Maker Pro

help -- muh logic ended in ruins

0xC0FFEE

Dec 16, 2017
4
Joined
Dec 16, 2017
Messages
4
I read an old textbook on digital electronics and built myself eight nor gates
and eight nand gates from discrete CMOS pairs of transistors. I can
screw the gates together to form typical textbook examples like 2bit-demux,
latches and the like. This works for most simple circuits, but does not scale
well due to signal degredation. I can't explain that phenomenon, but my suspicion
is that the p-channel fet and the n-channel fet are not quite appropriate for each other.

USING 2N7000 and VP2106

I used ye olde 2N7000 (n-channel) and a VP2106 (p-channel) at first. That
somewhat works, but I ended up with logical zeroes as high as 0.8 V and
ones as low as 4V for a rail voltage of ca. 5V at some spots in some
circuits. I tested scaling with what I considered an extreme test, cascading
nands and nors in such a manner that each is the inverter between the
previous and next inverter. That gave me consistent ones and zeroes with
0V and 5V, respectively, with differences in the range of a couple of
hundredth of a volt. The other test was to drive multiple inputs with
a single output, what worked equally well.

Those are not good tests, as it has turned out.

Such constructions always work very well, even
for voltages as low as 3V, and even if the same gates do not work
so well in other circuits.

To wit, things become less digital in an unclocked D-latch and
a purely combinational humble Xnor from four nors. What's more, those
circuits fail to process all inputs correctly at 5V rail voltage
and need 6V in most cases. This I do understand -- at 5V, the
VP2106 is not quite in the range of saturation, as the datasheet
reveals. I did not look at the datasheets at first, because there
were circuits on the internet that totally worked in aforementioned
cascades of gates. Not before the problems occurred did I read
the datasheets.

USING 2N7000 and ZVP3306

So I made a batch of four nands and four nands using pairs of ye olde
2N7000 and another small-signal p-channel fet, the ZVP3306.
The p-channel ZVP3306 reaches saturation at
slightly lower voltages, and I want circuits to work with
4.5V (three AA batteries) or even 3V (two AA batteries).

The new gates worked with 4.5V rail voltage, even the D-latch,
but signal degredation got worse for the Xnor circuit.
I guess I made things worse with the ZVP3306, because it is
more sensitive at low voltages than the VP2016, meaning it
amplifies small disturbances more than the
VP2106. In extreme cases, several 2N7000 got hot enough to really
hurt -- presumably, because the complementary p-channel transistor(s)
don't turn off correctly and a short between the +V and 0
occurs. (This is not supposed to happen with CMOS.)
I did all sorts of voltage measurements, tabulating all
drain-source-voltages and drain-gate-voltages on each transistor
in the circuit.

I found that the voltage measurements
give strange results in and around the spots where the
problems occur (duh). Often the measurement interferes with the
outcome. Those are not contact problems or symptoms of floating inputs,
because swapping gates does not swap the troublesome spots
with them. And I tested all connections with the beeper
on my multimeter.

Each abberation is intrinsic to the schematic and particular interactions
of transistors. The problems are consistent.
(that is, until the one or other 2N7000 gets really hot and dies.)

WHAT CAN I DO?

I'm still working on my understanding of transistors, so it is still
spotty. I guess parasitic capacitance in the FETs is to blame, or
something practical like that. (I wanted to ground my understanding
of ethereal logic in something real and hands-on and electronic,
so those technical problems are probably exactly what I asked for,
although I did not know that when I started. CMOS was a concession
to my ignorance -- I thought it would be the easiest thing to
do, even for a rookie.)

What can I do? Would it help to use CD4007 chips?

Those are (mostly) discrete transistors on a chip, so my hope
is that they are exact complements and scale well for larger
circuits, perhaps longish shift-registers or even a digital
clock.

I would prefer discrete TO92-transistors for reasons of glamour
and nostalgia, but I learned from the internet that
discrete 4-pin small-signal FETs are not made anymore, so I
will need CD4007s for future transmission gates anyway.
(Not needed for simple nors or nands, of course.)

Thanks for your help, or your attention, at this point.
I understand that, before chips, CMOS was not used at all
in digital electronics, or any FET, for that matter.

I'm more than willing to back
off from CMOS, but I also want to build transmission gates,
and that seems to be easiest with FETs. My feeling is
that CD4007s are the ticket, with many textbook-examples
available, but then again, textbook-examples apparently
don't work as advertised for even modestly complex
circuits. I could not find practicioners on the internet
who use discrete CMOS fets for building such circuits.
This suggests that it is a bad idea to begin with. Suggestions,
opinions, anyone?
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
Welcome to EP.

In short:

CMOS means Complementary MOS and that you have done,
but the name lacks the most important term,the NMOS/PMOS pair should be a well matched pair.
You can't get that with discrete TO-92 style,since the transistors are not on the same die.

So yes,using the CD4007 will help a lot.

What do you mean when you say "transmission gates"?

You don't see people using discrete FETs to build CMOS simply since it is has all the disadvantages possible: Cost ,Size,Low-speed etc.
The only advantage would be learning ...;)
 

Audioguru

Sep 24, 2016
3,656
Joined
Sep 24, 2016
Messages
3,656
Without a schematic showing resistors and current we are just guessing. The datasheet for a 2N7000 shows that some of them barely turn on with a gate voltage of 3V and you tried a power supply that was 3V so how could it work? Other 2N7000 Mosfets try to conduct 600mA.

With a supply voltage of 5V the CD4xxx series of Cmos logic works perfectly. But the current is very low then the P-channel and N-channel can both be conducting all day long with a current of only a few mA. You can also short circuit an output and it sits there conducting only a few mA. Some circuits use Cmos gates and inverters as a linear amplifier biased at half the supply voltage. Your 2N7000 might conduct nothing or 600mA.

Since you do not have the Mosfets used in Cmos logic then why not use Cmos logic inverters (CD4069) and some CD4007 separate Mosfets to make your gates?

Making your own gates? I never did, I simply bought them already made.
 

0xC0FFEE

Dec 16, 2017
4
Joined
Dec 16, 2017
Messages
4
Good day, kind Sir dorke!

Thanks for your reply, it had the effect of turning me into a
CD4007-fan over the weekend.
I could not get rid of the feeling that lack of successful role models
on the internet is a bad omen for my undertaking.
(No competition = no business, as they say.)
As for transmission gates, I intend to use them for interconnect
between units like shift registers, that is, like a railway switch
in what can be perceived as a control unit.
There are not many examples for CD4007 transmission gates on the internet,
but I have a Don Lancaster-book discussing them in detail. I have
no practical experience with those chips, however.
 

0xC0FFEE

Dec 16, 2017
4
Joined
Dec 16, 2017
Messages
4
Thank you for your elaborate answer, stranger!

> Making your own gates? I never did, I simply bought them already made.

This is for learning, not for having. It makes no sense except that
I like screwing together flipflops and other basic circuits from
homebrew gates that look like soviet avionics, for as
long those logic gates work. They currently don't.

> Without a schematic showing resistors and current we are just guessing.

I did not include schematic, because the gates are nothing fancy,
the schematics are pasted all over the web and all books on digital
electronics. So I thought everybody here would know them.

> The datasheet for a 2N7000 shows that some of them barely turn on
> with a gate voltage of 3V and you tried a power supply that was
> 3V so how could it work? Other 2N7000 Mosfets try to conduct 600mA.

Yes, but a homey bought a bag with a thousand 2N7000s, I did not
expect any problems and gleefully started soldering. That even worked
for single gates, but in hindsight I'd say it was beginners luck that
put me on the wrong track. I would have preferred to fail faster.

> With a supply voltage of 5V the CD4xxx series of Cmos logic works perfectly.

That's what Don Lancaster says in "Das CMOS-Kochbuch" (1976), a
German translation of his seminal "CMOS Cookbook".

> But the current is very low then the P-channel and N-channel can
> both be conducting all day long with a current of only a few mA.

Thanks for pointing this out, because this is exactly what I
observe.

> You can also short circuit an output and it sits there
> conducting only a few mA. Some circuits use Cmos gates and inverters
> as a linear amplifier biased at half the supply voltage.
> Your 2N7000 might conduct nothing or 600mA.

This makes sense, but my problem seems to be that the transistors
act as amplifiers, not switches.

> Since you do not have the Mosfets used in Cmos logic then why
> not use Cmos logic inverters (CD4069) and some CD4007
> separate Mosfets to make your gates?

I will. I opted for discrete transistors at first for
irrational reasons, perhaps a fetish.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Your 'transmission gates' are sold in commercial foram as 'analog switch', e.g. CD4066.
A pure transmission gate is typically used on-chip, but not as a discrete component on a PCB.
 

Audioguru

Sep 24, 2016
3,656
Joined
Sep 24, 2016
Messages
3,656
A Mosfet is an amplifying transistor. Since a CD4069 inverter is low current Cmos it does not conduct hundreds of mA and get hot but it can be biased at half the supply voltage and be an amplifier. Here is an example where the inverter has a 10M negative feedback resistor and a 1k input resistor. If its input to the 1k resistor has a coupling capacitor then its negative feedback causes its output to be at half the supply voltage so an input signal will cause its output to swing up and down and be an amplifier. +40dB is a voltage gain of 100 times. Without the 1k input resistor the voltage gain might be 1000 or more. It is shown that the supply voltage affects the gain since it affects how much current the Mosfets conduct into each other.
 

Attachments

  • Cmos amp.PNG
    Cmos amp.PNG
    29.7 KB · Views: 180

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
O.K.
For learning, they are good.
But I wouldn't build any real word thing with them.
With the exception of Oscillators.
The only one I have ever used was the 74HCU04.

There is another important issue to learn: why buffered vs. un-buffered gates.
Read this it will help you a lot.
You should understand why digital CMOS is practically almost always buffered.

I looked-up Don Lancaster CMOS cookbook,
it is an old 70s book,a lot has changed in the CMOS world since.
 
Last edited:

Audioguru

Sep 24, 2016
3,656
Joined
Sep 24, 2016
Messages
3,656
A Cmos oscillator is made with a single Schmitt-trigger inverter, a resistor and a capacitor. 6 of these inverters are in a CD14106, CD4584 or MM74C14.
 

Attachments

  • Cmos Schmitt oscillator.PNG
    Cmos Schmitt oscillator.PNG
    19.2 KB · Views: 127

0xC0FFEE

Dec 16, 2017
4
Joined
Dec 16, 2017
Messages
4
Thanks guys, for the extra information and links. It took
a while to digest. I met some experts over the holidays
and browsed a few books for answers to my CMOS-blues. I
got important clues from a book for aspiring chip designers
that had a fairly detailed quantum mechanical explanation
I did not understand for most part, including all sorts
of schematics of "parasitic bipolar transistors" emerging
from poorly constructed CMOS circuitry on chips. (See
@The future below if you are interested.)

I hope it is not too late to wish you a happy 2018!

@Audioguru:
Thanks for that oscillator. This is what I will use for
generating test input for my homebrew logic in order to
test the limits of the technique. I'll be curious to see
if a larger assembly can handle more than a MHz gracefully.
As for the CMOS amp: Wikipedia mentions amplifier application
for the TTL inverter, but I did not know that you can do
that with CMOS inverters, too.

@dorke:
The PDF about buffered and unbuffered logic is great
and most definitely pertinent to CMOS. Don Lancaster
mentions buffered vs. unbuffered logic, but only to
dismiss unbuffered logic as "tricky" and in order to
justify the focus on buffered logic in his book. The
text was also a vocabulary-expanding experience,
because I'm still at odds with many English technical
terms.

@Harald Kapp:
I will probably use analog switches for interconnect,
but CD4007 will be first. Again, nonsensical for having,
good for learning.

@The Future:
Building logic gates from discrete FETs is probably a bad
idea. At least if you want to show off more complex circuits.
There are no role models for that on the internet (Jan. 2018) --
probably for the following reason.

The textbook examples do work for single gates and even
for many circuits, but not for all larger circuits. A D-latch
or full adder, for example, deteriorate into a flea circus
of stray coulombs between source and gate. The reason is that
FETs control source-drain current via the field effect, i.e.
the metal oxid ("M.O." in MOSFET) insulator film acts as a
dielectricum giving you a capacitor. The stored charge controls
the doped semiconductor layers via its field effect. This is
the reason why FETs switch with VOLTAGE, not CURRENT, as
bipolar transistors do. (In bipolar transistors, the controlling
electrons are "consumed" and need to be replenished with new
electrons, what constitutes a current of electrons. I hope
the veterans here are satisfied with that explanation.)

The problem is, without extra circuitry, residual charge might
get stuck. Consequently, in larger circuits, these effects
get amplified by downstream gate transistors, or worse, in
gates involving feedback, as in latches or flipflops.
If you have a homebrew CMOS circuit already that behaves oddly,
you can suck stuck coulombs by touching the ground wire in
an electrical outlet and then touching the gate of the FET
which does not work as expected. The charge dissipates into
your body and restores signal integrity in the circuit (assuming
that this is the only problem with it).
Another problem I discovered is that identically built CMOS-
gates behave very differently in terms of how much current
they draw, even while working perfectly. Range is between
3 and >100 mA.

Thus, homebrew circuitry is not good for teaching or learning
digital electronics. (And p-channel FETs are fairly expensive,
although it is probably the contact material and PCBs that will
drive your cost.)

The traditional hobbyist route to discrete logic
is diode transistor logic. In contrast to homebrew CMOS, there
is a large body of role-models, examples and detailed instruction
and discussion on the internet -- including scanned schematics of
DEC minicomputers from the 60s.
 
Top