sk1qn1- Devices with multiple gates

create counter



This page was created after 10 November 2011, and thus should not have any errors in it due to my earlier confusion between the roles of pin names and pin and pad numbers. (I have a page with more on this if you are really curious!)



Before you embark on this tutorial, you should become familiar with power ports and invisible pins.

Devices with multiple gates

A widely familiar example of a device with multiple gates is the TTL quad NAND designated the 7400…

(Image from Wikipedia 7400 article, with thanks.)

In it, you see four independent NAND gates. There are also two pins for connecting the electricity to make the chip "go", pins 14 and 7.

KiCad's 7400 component

What happens if you place a 7400 component on "the page" when drawing a circuit diagram with eeSchema, the relevant part of KiCad?

You see just….

What KiCad draws is one of the four gates from inside the chip. We'll come back to how you work with this in a moment. First a detail can be got out of the way…

What about the chip's Vcc and GND connections, pins 14 and 7? You may have noticed that there is no provision on the KiCad 7400 component for attaching wires to these important pins. Pins 14 and 7, on the KiCad 7400 component, are invisible pins. Those connections are dealt with… very neatly… by power ports. Power ports may make you tear your hair a bit at first, but they are a clever idea, and, in the long run, I hope you will end up liking them.

It looks like KiCad's 7400 component is too simple to represent the 14 pin package that contains the device in real life. Fear not… the secrets will emerge, as we proceed. It may be worth a quick trip to KiCadHowTo's "encyclopedia" entry for multi-gate components at this point, for a quick introduction.

KiCad's 7400 footprint

The 7400 doesn't have its own KiCad footprint. It doesn't need one! This is because of the elegant way KiCad works.

You will just use a general purpose DIL-14_300 footprint for putting 7400s on your PCB designs. This is nothing special, just the usual KiCad systems at work.

The DIL-14_300 footprint is the right size and shape, and provides for 14 pads numbered 1,2,3… 14. Which, not by coincidence, but still happily, is exactly what the KiCad 7400 component needs.

An exercise…

To give us a practical example of working with a 7400, a device with multiple gates, we are going to draw the equivalent of the following circuit with eeSchema, and then convert that to a PCB….

(My thanks to eleccircuit.com, from whence it came.)

The circuit is an oscillator, driving a speaker through a transistor in order to provide a louder sound than would be possible using the 4011 alone. The circuit implements a simple buzzer. The state of pin "1" of IC1a determines whether the buzzer is on or off. You can have different tones if you change some of the passive components.

To follow along exactly what I am doing, you need to start a new project, in a folder of its own which I've called tmpqn. (TeMPorary stuff, Quad Nand.) I've also called the project tmpqn.

(There's nothing built into KiCad or Windows to treat the name as "special", just because it begins "tmp"…. it is merely my working practice which says "If you come across this later, so much later that you can't remember what it is, you can just delete it. You would not have saved it with this name if it were something you might want." This is a useful practice!)

So… start a project. Start a schematic. Place two 7400 NANDs on it….

Note that you have NOT, I hope, placed two 7400 components on your schematic. (If you have, we will fix that in a moment). You have placed two parts or units from one 7400 component on the schematic.

That's a start, but you probably noticed the numbers on the three connecting points, "1", "2" and "3". They are telling you that these components will be mapped onto pads 1, 2 and 3 of the footprint we are going to associate with them. Not satisfactory! One of them can be the NAND we connect to like that via the DIP-14 socket.. but the second one should be using "5", "6" and "4".

Not a problem….

Right click on the right hand NAND component, and opt to edit the component. You should get the following dialog. (I've chopped off the bottom 2/3rds)

The bit we need just now is in the upper left, the "unit" listbox. Change the entry there to "2", and click "okay" to leave the dialog. Presto chango! The pins on the right hand NAND component now say "4" "5" "6"….

And now set the "reference" property for both (part) 7400s to "IC1" (or "U1", if you prefer). On the schematic, you should see IC1A and IC1B… the "A" and "B" suffixes are taken care of for you by KiCad.

All because "the component" isn't as simple as we at first thought.

When we were working with simple things like resistors, what you saw when you placed a component was pretty well everything that the component was.

That doesn't mean that all components are so simple!

Besides the simple components (resistors), there are the [[[co1powp | power ports]], which are components… just "special", and there are things like the 7400. (That's "all" the different sorts of components, though. Whew.)

Things like the 7400 are components with multiple "copies" of something in a single "package"

In our early work with, for instance, resistors, what we got when we placed a component was just about all there was to know about the component.

We're about to descend into some murky depths. You don't need what's between here and the next heading to "just use" devices with multiple gates. But I always think that the more you know of the inner workings of something, the more clever you can be in your use of it. Do read the first bits, though, before you start skimming!

With multi-gate devices, you have to take even more care with the already fraught word component. As I mentioned near the top of this, I have another page for you with a short exposition on the subject of multi-gated components- i.e. "the encyclopedia entry".

Okay, you can skim to the next heading now, if you are in a hurry.

With a 7400, "the component" is more than you see when you place one NAND gate symbol on the schematic.

In the component properties dialog, the small listbox in the upper left is but a modest indication of how clever the component is. In the case of the 7400, the choices in the listbox are "1", "2", "3" and "4". That's because the 7400 has four gates available to you. The numbers give you a way to select a specific gate, or "part" or "unit". (You don't, as someone new to this might think, get three NAND symbols if you select "3".)

To just use a 7400, you don't need to look further. To understand the "magic" of what's going on, you do.

Not only does the component definition say that the device has four gates, it also says which pins are associated with each of the gates. It also defines the two invisible pins for connecting Vcc and GND.

If there's a way to see "the whole picture" in the case of a multi-gate component, I don't know what it is. However, you can load "the component" into the component editor in the normal way, and see one of the gates at a time. "The secret" of dealing with the details of a multi-gate device is in the little listbox in the upper right of the window….

You use this to specify which of the parts, also known as units, that make up the overall multi-gate device, that you want to look at for the moment. The component's properties allow you to say how many gates/ parts/ units are in the device. Once you have set that, the component editor allows you to lay down the lines, etc, which will be used to represent each of the parts. When you call up "the component" in the component editor, you are actually calling up one member of a "family" of "components"… actually parts of one component. Which one you are dealing with at any given moment will be determined by what is in the listbox marked in the illustration above.

I struggled a bit, but there are ways to make the definition of one part differ from that of another. To have each part assigned it's own pin numbers appears to require that you give the pins names in addition to giving them numbers, by the way.

The system leans towards applying any change you make to what appears on every part… but you can "fix" things so that one part is different from another in more ways than the pin numbers.

The system takes care of identifying the multiple parts as "A", "B", "C", etc… and I don't think you can replace this with an indexing system of your own.

Most of the time you are dealing with one of the multiple "parts" inside the hard-to-look-at-overall component, and the parts seem to be "components" in their own right, they aren't. For instance, the 7400 will have just one "reference" property, and when you are looking at one of the parts of the component, you will see that reference ID displayed, with a letter suffix to tell you which part of the whole component the "thing-that-looks-like" "a component" you are looking at.

Right… that's the end of the stuff that you might want to just skim though.

The rest of the circuit

Most of the rest of the circuit is unremarkable, and we proceed to create….

The transistor was an "NPN" component.

At the upper left, it is a "CONN_1" component, reference "P1", I've attached to pin 1 of the left hand NAND gate. It is for the input to the circuit which will turn the noise on or off.

At the upper right, it is a "CONN_2" component, reference "P2". That is for connecting a PSU to the circuit, and the associated ground. (No "rocket science here…. we had something similar in the introductory exercise.)

I used the component editor to examine the 7400, which revealed that the invisible pins were named Vcc and GND, hence my choice of…

The Vcc power port at the top, and the little triangle below the speaker is a "GND" power port.

Note that our KiCad diagram is "missing" the connection shown in the non-KiCad drawing at the top of the page… the connection to the 7400's pin 14. The drawing should, if it was going to show the Vcc connection to pin 14, also have shown the GND connection to GND. In our schematic, drawn by KiCad, those two are connections to invisible pins, and handled by the power ports.

I fiddled a bit with the components' "value" and "reference" fields to make the schematic match the one at the top of the page. There were KiCad defaults which would have sufficed for creating the PCB.

Note that I gave the two NAND "reference" fields of "IC1". KiCad added the "A" and the "B". I set the NANDs' "value" fields to ~ (the tilde character) to suppress anything from printing.

The KiCad design cycle proceeds normally from there….

  • Within eeSchema: Save netlist
  • Run CVpcb
  • Run PCBnew
  • Read netlist

During CVpcb, the following footprints were selected for our components. Notice that by this stage, KiCad is "admitting" that the "two" NANDs are in fact just parts of one device, IC1.

Component / Footprint
C1 and P2 / C2
IC1 / DIP-14_300
P1 / pin1
All of the resistors, and the speaker / R4 footprints
Q1, the 2N2222 transistor: TO92

That last one… the footprint for the transistor… required that I look up the pinout for the transistor, and that I check the pin number assignments for the NPN component. I won't swear I got it right… but that's what you look at in order to have the information to get it right yourself!

The C2 footprint is a poor choice for the PSU connection because it is not polarized, but I added some text ("Vcc") to the board, drawn in the "back" layer" to mark the positive terminal.

Here is a PCB which could carry the devices for us. As usual, it is not presented as an example of a "good" design, it is just to show you one possible product.

In a "real" board, we would probably have tied the floating inputs either high or low.


So there you have it… a project using a component with several gates in a single device. I hope the elegance of KiCad's handling of such devices was evident to you?

If you still want more, there may be an older attempt at this topic still available. (If it isn't, and I've failed to remove this note, please write and complain saying "You need to edit the 'link to sq1qn1old' at bottom of sk1qn1"… please? Save the next reader the frustration you've had?


Sorry… squeezing this in here, without proper attention to general organization of information on off…

Sometimes when you are making a footprint for, say, an IC with multiple units, the schematic for "Unit A" will differ slightly from that for "Unit B".

For example…

(An Opto Isolator, where the LED and transistor in Unit A "point up", but in Unit B they "point down")

No problem!… as long as you know "the trick"… and the thing that is NOT "the trick".

All of this: In the (ver 5.1.5) Symbol Editor…

First: The thing that is NOT the trick: Once you have a symbol in the program for editing, if you click Edit/ Properties, a buzy dialog opens. In the lower left there's a tickbox labelled "All units are not interchangeable". You want to leave that ticked, I think. Un-ticking it doesn't help, anyway!

So how DO you make the schematic symbols for the different units different: By tweaking individual graphic elements as follows…

Select a unit that is mostly what you want for that unit. Right-click on an element (line, or filled polygon) which you want different in a different unit. From that menu, click on "Edit Line Options".

A dialog headed "PolyLineDrawing Properties" should come up. Bottom item- but- one: "Common to all units in component". UN-tick that. You will see no changes… in the unit you are currently working on. Go to one of the other units. That element is no longer there, in the other units!

Once you've got the things that will be different in other units dealt with, go to one of those other units, and start making it how you want it. Remember to set new things as NOT "Common to all units in component", if you are adding something that should only appear in the unit you are working on.

By the way… you can copy things from one unit to another in the usual Select/ Copy/ Paste way. And rotate, move, etc selected elements.

Hard to explain… brilliantly easy to use, once you get the hang of it. Like all of KiCad! (End of ver 5.1.5 addition to page.)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License