Electronics for schools and hobbists: The Basics

Digital Electronics...

You will find many guides on the net... but have a look at the 'Inputs and Outputs' section for something which I don't think you'll see elsewhere.

Table of Contents:

Many books will tell you lots about logic chips: AND gates, NAND, NOR, XOR, flip-flop, etc, etc. Something that isn't always mentioned, because 'everyone knows' is that there will also be at least one pin to feed electrons into the device, and one to take them away. They are usually marked either '5v' (or some other positive number. V for volts.) and '0v'. They may be marked Vcc and Vss (Vss would be for the connection to 0v.)

Secondly, circuits will often have a number of lines which end marked '0v' or '5v'. In almost every case, all of those 0v points and all of the 5v points are connected up... the author of the diagram just didn't want to clutter it will all those lines. (All 0's to all other 0's, and all 5v's to all other 5v's... but NOT any 0v's to any 5v's!!)

I said 'in almost every case...' If you have an opto-isolator in the circuit, then the 0v's from the two sides of that are NOT connected. That's not a common circuit. Much more common are situations where the overall circuit is in several parts, e.g. my computer and it's monitor. All of the 0v's are connected, but the innard of the computer run off of voltages generated in that box, and the innards of the monitor run off voltages generated in it. The wires carrying these voltages are sometimes called the supply, or power 'rails'. Of course, the signals from the computer which determine what appears on the monitor are also carried by currents, produced from voltages. In theory, and in truth, SOME current flows from computer into monitor due to the voltage from the computer's power supply... however this is a tiny current. See the later section 'inputs and outputs' will make this more clear.

In simple TTL and CMOS work with logic, e.g. ANDs and ORs, you'll only need a positive voltage (5v in the case of TTL) and the other connection which is called zero for simplicity.

Though it isn't absolutely necessary, I've never seen a circuit which didn't have at least one bit marked zero volts, and there are often several. Any of these will do for one probe of the voltmeter. (And the meter would read 0v if you attached it to any other part marked 0v because there is no DIFFERENCE between the voltages from one of those points to the other. It would also read 0v if connected between any two points of the circuit marked 5v, or between a point marked 5v and another point which was connected to the first without any resistance between them. If there is a resistance, the meter won't read zero.)

Secondly, in some circuits, e.g. those with op-amps, you will see positive voltages, zeros, and negative voltages. Let's say the one you are looking at has points A, B and C, marked -6v, 0v and +6v. They could just as easily have been marked 0v, 6v and 12v. (MORE easily, as far as my little brain is concerned, but I'm sure there are good reasons for The Way Things Are Done.... I'm not as expert as I hope this makes you think I am.) What connections do you make? If you had to supply those voltages with batteries, you'd stack up 8 (1.5v each), all facing the same way. 'A' would go to the negative end of the stack, 'B' would go between the 4th and 5th batteries, and 'C' would go to the +ve end of the 8th. If you're getting your low voltage from an adapter driven off of the household suppy, no amount of cleverness will get you -6v, 0, and +6 (Sometimes called a +-6 v supply (with the = and - one above the other) from two +6v supplies... you'll just have to go with batteries, or buy an adapter with the different outputs.

In digital electronics, as we said, everything is either 'on' or 'off'. These two states are usually just called 'one' and 'zero', though 'red' and 'green' or 'up' and 'down' would be just as sensible.

Whether a light-bulb is 'on' or not is obvious enough, but what about other things? If the voltage there is over a certain value, that point is said to be a 'one' (e.g.'on'). If it is below a second value, the point is said to be a 'zero' (e.g.'off'). What are those 'certain values'? Don't worry about it! That's the beauty of digital electronics. Usually, the 'on' voltage is the nearly same as the positive voltage feeding the circuit, 5v in the case of TTL. Usually, the 'off' voltage is nearly zero.... but as long as they are close, that's going to work! (Unless there is something badly wrong with your circuit!)

(Just to be thorough, I suppose I should mention that there are times when engineers use 'negative logic' in which the names are Vers (tweaked 23903) ersed. Just be glad you are a hobbyist and don't have to do such things. If you ever get involved with RS-232 signals, though, beware: A '1' there is NEGATIVE 12v, while a 0 is Positive 12v)

A simple AND gate has two pins for input signals ('inputs') and one pin for an output. The following discussion of this specific device will give you a useful mental picture of inputs and outputs generally.

Imagine that inside the chip there's a little room with a tiny man in it. The wires from the inputs connect to light bulbs, and the second connection of each light bulb goes to the zero volts wire of the circuit. If you connect the input to a Vcc (e.g. 5v in the case of TTL) part of the circuit, the bulb comes on, if not, it doesn't. (By the way (important): These are 'magic' bulbs that have a very high resistance, but can still glow even when only a tiny current flows.)

In the room, the wire that connects to the output pin is always connected either to the circuit's zero volts or to it's Vcc. The 'little man' takes care of changing it over between the two when needed. Because this is an AND gate, he will connect the output to Vcc when the first bulb AND the second bulb are on... i.e. when the inputs (outside the chip) are connected to Vcc. Otherwise he connects the output wire to 0v.

Notice the beauty of the system... the out put of one chip can feed the input of another.


Some details:

With CMOS chips, connect any unused inputs to either 0v or 5v, don't leave them simply connected to nothing ('floating')

Despite the description I've given of the workings of outputs, you cannot connect anything with low resistance to them. They cannot conduct much in the way of current. With TTL or CMOS chips running on 5v, a 680ohm resistor and an LED in series is okay, though. The 'arrow' of the LED should point away from the connection to 5v. You won't hurt anything by putting it in backwards... it just won't work. For bigger things (lightbulbs, most relays, etc) you need to connect the output to the base of a transistor, and use the transistor to turn the bigger thing on & off.)

In theory, you could just have an actual wire connected to an input, and (by hand) move it back and forth between a connection to 0v and one to Vcc. This isn't a good idea. Better is to connect the input to Vcc through a 10k resitor, and to connect a switch between the input and 0v. when the switch is open, the input 'sees' Vcc. When the switch is closed, the 'more obvious' 0v is what the i/p 'sees'. (You have all it takes to understand why that works on a volts/ohms/amps level (just remember that the connection inside the chip from the input to 0v has a very high resistance) ... but why bother? If it works.. use it.)

Even with this 'better' approach, you need to know that in the unimaginably fast world of electronics, when you close (or open) the switch, it will actually open/ close/ open/ close a number of times, very rapidly, as it goes from one state to the other. This is called 'bounce.' It won't matter with an AND gate, but it can matter. You'll know you're in one of those situations when it arises.

The humble AND gate is a level triggered device. The 'little man' inside has a very simple rule to follow. It doesn't matter what the inputs were previously, he 'connects' that output wire according to what they are NOW.

There are also things which are 'edge' triggered. The little man inside those looks for CHANGES in the inputs. The change is called an 'edge'. A change from Vcc (5v in TTL) to 0v is called a negative edge. A change from 0v to Vcc is called a positive edge. A flip-flop is an example. They come in various types, but a nice simple one has two inputs and one output. The inputs are called S (for 'set') and R (for 'reset'). 'Set' means 'make it a 1', reset means 'make it a zero' (NOT 'out it back to what it used to be.') In my nice simple flipflops, the little man ignores negative edges. However, if he sees a positive edge on the S input, he makes the output a 1. (i.e. connects it to Vcc). After that, he doesn't care what the S input does... it can stay '1', or fall back to 0. He will only change the output over to a zero if he sees a positive edge on the R input. Again, the R input can do what it likes. The output will stay zero until the next positive edge on the S input. Not quite as simple as the level triggered devises.. but useful!

Tom Duncan's book, Adventures with Microelectronics, gives an excellent 'hands on' introduction. ISBN 07195-3671-5
Click here to return to the start of my electronics pages

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows pc) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!

Click here to visit editor's freeware, shareware page.

Here is how you can contact this page's editor.
Click here to go up to general page about electronics by editor of this page.
Click here to go to editor's homepage.