# BJT vs MOSFET for logic gates help

#### Audioguru

Sep 24, 2016
3,656
Tristan, do not read all the errors said by Ratstar.
Tristan, since you want a non-volatile memory, then instead of randomly making one that has an extremely small capacity, buy a non-volatile memory chip? My camera and cell phone use very small low current non-volatile memory modules.

#### Tristan369

Oct 29, 2020
32
Ok a few last questions, so now I'm interested in CMOS haha. I learned how to make logic gates with CMOS and it doesn't seem very hard and according to wikipedia it is 100,000 times more energy efficient than equivalent BJT circuits. And I really like the idea of not using resistors or voltage division for some reason.

So as I understand, the point of CMOS is so that the output is either high or low, instead of being either high or floating, right? So like in this image here https://www.oreilly.com/library/view/introduction-to-digital/9780470900550/images/ch005-f007.jpg the output will be either high or low, but not the input, so if that input weren't connected to the output of another CMOS logic gate, it would need a pull down resistor? So there needs to be at least one pull-down resistor in any CMOS circuit?

#### Nanren888

Nov 8, 2015
622
Like you said, each input is connected to high or low, never floating.
You can arrange this any way that suits.
.
Normally it would be driven from some other output, such as an oscillator or similar. Another example would be a digital output sensor. Internal circuitry derives a digital representation of the correct output and that's what the next gates see. Internally things might be driven by comparators, that always drive high or low.
.
Yes, if for example you scanned a keyboard with cmos gate inputs, you'd likely have pull ups, or downs somewhere.
.
Actually if you leave a normal cmos input floating, bacuse the input impedance is so high, it will oscillate with any stray field. At that point the cmos will often get hot as it's spending all its time switching.

#### Tristan369

Oct 29, 2020
32
Ok so now I am running into a problem where I can't have one MOSFET power another because they just share capacitance or something. Here is an image to illustrate it

The circuit on the right stays on no matter what. It would seem the only solution is voltage division but that destroys the entire point of using CMOS.

#### Bluejets

Oct 5, 2014
6,862
So as I understand, the point of CMOS is so that the output is either high or low, instead of being either high or floating, right?

Cmos acts the same as other logic with the same requirements as far as floating inputs.
It is a high impedence circuit so low current.
I don't know what this obcession is that you have with "efficiency" is all about.
Use resistors where required, it's not going to break the back of any power supply.

#### Audioguru

Sep 24, 2016
3,656
Tristan, why do you use the Source of your Mosfets as the output instead of using the Drain as the output like in Cmos circuits?
What is the "C" in Cmos? It is "Complementary" which is P-channel and N-channel, not just one type.
Here is a Cmos inverter that draws almost no current if it does not run fast:

#### Attachments

• Cmos circuit.png
20.6 KB · Views: 1

#### Tristan369

Oct 29, 2020
32
Oh I see, so everything has to be NOT gates? Is there any CMOS NOT-NOT gate? lol Do you have to put two in a row if you want voltage to pass through the output with a high input? I guess it's arbitrary which is high and low in my case but still. And so N type MOSFET's don't really even work together unless combined with P types? I looked up NMOS and it uses P type MOSFET's too.

Ya check it out I converted one of my basic bjt designs into a CMOS and it only uses 1.5uA. I don't know why but that is really cool to me. Totally worth the extra cost in transistors.

Last edited:

#### Audioguru

Sep 24, 2016
3,656
Why don't you look at the datasheets for Cmos ICs?
A CD4001 has 2-inputs NOR gates.
A CD4071 has 2-inputs OR gates.

Did you notice that there are no diodes and no resistors on real CMOS logic gates?
Why are your inputs on the right side but everybody else has the inputs on the left side?

#### Attachments

• CD4001 and CD4071.png
38 KB · Views: 3

#### Tristan369

Oct 29, 2020
32
That is true, my SR latch needs to look like this apparently

I just made it the way I make them with BJT's which works but it needs those diodes. So the 2n7000 is a small N channel MOSFET, do you know of any p channel MOSFET's that are that same size? And thank you I will definitely check out those datasheets.

#### Tristan369

Oct 29, 2020
32
Check it out I was able to make the SR latch part of my non-volatile memory design CMOS and it draws much less power. There would have been two more pull down resistors if I used straight BJT's. It keeps the capacitor charged while on at a higher voltage than my BJT design, but it takes way longer to charge and discharge the capacitor. Any advice would be much appreciated.

#### ratstar

Aug 20, 2018
485
how did u fix it? by guarding the ground with another mosfet?

#### Nanren888

Nov 8, 2015
622
I've seen three conventions.
Electronics (Most ocmmon): Power, often positive, at the top, ground, or negative at the bottom. A sense of up is higher potential. Signal flow, usually left to right.
Physics texts: Power supply potential is left to right, (Battery at the top) Signal flow, well often rather confused seeming but tending left to right..
Yours: Cannot fathom the trend in the supply, potential.

Is there a "Q" somewhere?

Last edited:

#### ratstar

Aug 20, 2018
485
+ and - at the bottom, and then its like an enclosed feedback machine, like an oscillator, except its a register instead, they are similar. I figure thats why they call em flip flops, cause you just invert the logic polarity of them then they oscillate, the astable multi-vibrator is a similar situation.

the set and reset is at the bottom as well.

Last edited:

#### Tristan369

Oct 29, 2020
32
Haha I basically just made it and then brought power and ground to everything to use less wire (mainly for cleanliness). The power and ground sort of both wrap around the whole thing. The ground looks like the letter C, and power looks like a backwards letter C. Left on my own I always do things the opposite as the way most people do it haha. OR like I'll find a super complicated and convoluted way of doing what is a really simple thing.

#### ratstar

Aug 20, 2018
485
Its funny that you call this simple, I dont call any of it simple, I cant even get my oscillator to work... What's your finished product going to be? (Im making high hz'ing analogue physical logic physics engine simulator!!! Its gonna make me millions. just need to get things working.)

Theres so much you can make once u understand electricity properly, the world is your oyster.

#### Tristan369

Oct 29, 2020
32
At first I was just trying to make a calculator and then I had a sort of eureka moment when I realized how computers work and how simple they actually are and now I want to make my own 8-bit computer and ISA with modular PCIE RAM and logic cards. And of course lots of blinking LED's. I'd even like to make a multiplex display that just connects as RAM basically. I think if I had an add function, subtract, jump, and a few others like making one register equal another, I could just about compute anything with enough memory. I'm basically making one of these or like Ben Eater's but with transistors instead of logic gate IC's.

Last edited by a moderator:

#### ratstar

Aug 20, 2018
485
Hes got a secret panel on the back that makes it run at 100 gigahertz I bet. *tap the nose*

#### Nanren888

Nov 8, 2015
622
Go for it.
The megaprocessor has quite a number of registers when you get down to it.
Might want to read up on "RISC" designs to get an idea of how small you can go.
.
Why 8-bit?
Have used 4-bit processors in the past. Can be just as much fun.
.
BTW: Instruction set width does not have to match data width, depending on the architecture that you choose.
I think there is a "projects" forum.

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,647
Hes got a secret panel on the back that makes it run at 100 gigahertz I bet.
I'll take that bet, sure to win.

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,647
Left on my own I always do things the opposite as the way most people do it haha.
You and @ratstar aren't siblings, are you?

Replies
2
Views
1K
Replies
4
Views
1K
Replies
1
Views
1K
B
Replies
13
Views
2K
Robert Monsen
R
J
Replies
6
Views
5K
D