Soldering On (Part 8)
Tim Edwards concludes our first introduction to electronics with the Ins and Outs of logic
To conclude this introductory series of articles on simple electronics we will review some logic circuits and techniques. Although you would not normally think of logic circuits as directly associated with electronic music, it is these circuits which provide all the control for the oscillators and envelope shapers in your typical synth. Logic is also used to produce sequencers, digital noise generators and increasingly pure digital synthesis of sound and speech, as witnessed by the many products advertised in this magazine.
Fig 1 shows the symbols of the common logic elements or gates along with their truth tables. A '1' indicates a true condition and a '0' represents a false condition. So, for example with a two input AND gate, the output is only true (or a '1') if both inputs are at a logic '1'. The actual voltage levels for an '0' and a '1' can be anything and will be defined for a particular system. It should also be noted that a system can be defined as negative or positive logic. With a negative logic system the'1' level is a lower voltage than the '0' and vice versa for positive logic. Positive logic is the more common.
The truth tables shown can be extended to include any number of inputs. Also notice from the truth tables that, although an inverter is a logic element in its own right, it can be formed from a NAND, NOR, XOR and XNOR gates, by tying one input either high or low. Some gates are available with a variation known as Schmitt trigger inputs. Here the internal circuitry is provided with positive feedback such that the output 'snaps' very quickly from one state to the other even though the input voltage may only be changing very slowly. There will also be hysteresis on the input. The voltage level at which the output changes when the input is rising is called the Upper Threshold and that at which the output changes for a falling input the Lower Threshold. The difference between these two voltages is the input hysteresis. This is very useful for 'cleaning up' noisy signals and stops the circuit from oscillating.
All the standard digital integrated circuits containing counters, shift registers, adders and so on will be constructed from these basic gates. Even a microprocessor is a collection of thousands of the same simple logic elements.
One of the most common uses for logic is to build latches. These are also called bistables or flip-flops and form a simple memory element, that is, the output remains in its present state until forced to change — in other words it has remembered the last thing that occurred at its input. Fig 2 shows reset-set (R-S) latches made from cross-coupled NAND and NOR gates. Note that the trigger pulse is different in each case, negative going trigger for the NAND, positive going for the NOR. This type of flip-flop has complementary outputs Q&Q — one will always be the inverse of the other. A trigger pulse on the set input will be ignored until a reset pulse is applied to the Reset input.
There are other types of flip-flop such as the D-type latch, J-K Master Slave and toggle or T flip-flop. Each type has its own special characteristics and logic data books are best referred to for details. By putting a series of latches together with associated gating, shift registers and counters can be produced. A simple shift register could have two inputs, a data input and a clock input. If we present a '1' at the data input and then apply a clock pulse, the logical '1' is moved into the first position of the shift register. Each subsequent clock pulse will move this data bit one stage further along the register (see Fig 3). If there are eight stages to the register then eight clock pulses are required to move the data bit from input to output. Any subsequent data bits applied to the input will also be clocked through even if the first bit has not completed the journey through the register.
When cascading flip-flops to form a counter, each stage will divide by two, so four flip-flops will be needed to count to 16. There are many different counters available in chip form and it is usually unnecessary to build your own. Fig 4 shows a chain of J-k flip-flops connected as a ripple counter.
The J-K inputs can be used to force the outputs to a particular state, but in this configuration the flip-flops simply toggle from one state to the other every clock pulse. These flip-flops are designed such that they will only toggle on the falling edge of the clock pulse. Since the clock for each, except the first flip-flop, is provided by the previous output, it is easy to see that each stage divides by two.
Of the many logic families that have been and gone or are still in existence, only two will concern us. These are TTL (Transistor Transistor Logic) and MOS logic (Metal Oxide Semiconductor). Within each of these two families there are several groups. Taking TTL first, most of the integrated circuits you will come across in this family will be prefaced by the number 74 eg 7400, 74132, 74151 etc. These devices will come in different forms; they perform the same function but the characteristics are different. Those mentioned are the standard TTL IC's; 74LS00, 74LS32, and 74LS151 perform identical functions and the pinouts are the same but the current consumption and power dissipation are greatly reduced. The price paid for this is a slightly slower propagation time for the signal, but this is only important in very high speed circuits using a large number of logic gates. (Propagation delay time is, crudely speaking, the difference between the time that the signal appears at the input and the time that it appears at the output). Other versions are prefixed 74S, 74F, and 74ALS and are faster versions of the same family for special purposes and need not concern us.
TTL logic is constructed using bipolar transistor technology and for many years has been the dominant logic series, especially in high speed and computer applications now the new MOS families are starting to encroach even here. A previous 'Soldering On' article described the PMOS & NMOS transistors. CMOS logic (complementary Metal Oxide Semiconductor) uses p channel and n channel to form the switch element (Fig 5).
The advantage of this arrangement is that only one transistor is switched on during the quiescent state. The off transistor exhibits very high resistance (many megohms) and consequently, if there is no output current then the quiescent power dissipation is, for all intents and purposes, zero. However during the switching period from one state to the other, there is a short time during which both transistors are conducting, and so power is dissipated when the circuit is active. At high frequencies (1MHZ upwards) this dissipation can become considerable. CMOS circuits also have the advantage over TTL in that they can tolerate a wide voltage supply range. Typically this is 3V to 16V whereas TTL is only designed to operate at 5V plus or minus 10%. For this reason, if you want to experiment with logic circuits, CMOS is the easiest to start with, simply because you can drive it from an unregulated supply, eg, a 9V battery.
Until recently, CMOS has not been suitable for direct interface with microprocessor and similar circuitry because of the slower switching times, but now the new high speed CMOS (prefix 74 HC) is available which is comparable to the 74LS family in speed and pin outs but with a much reduced power consumption. The voltage supply limits are narrower than standard CMOS 3V-6V, but this is still less stringent than the TTL requirements. Another very valuable attribute of CMOS circuitry is noise immunity. The construction and switching characteristics of CMOS devices means that (a) they change state when the input rises to about half Vcc and (b) they tend to 'swallow' noise rather than propagate it.
CMOS disadvantages are the reduced current drive capability and poor ability to drive capacitive loads due to the inherent output resistance of the gates. This is generally not a problem when driving other CMOS because the inputs are very high resistance, typically 1014 ohms (100 million megohms). This in itself can cause problems because very high static voltages can build up on the metal oxide insulated input. The electric field across the very thin oxide input can be enormous and if too great will literally punch through the insulating layer and so destroy the device. To help prevent this, all inputs are protected by diodes across the input as shown in Fig 5. These offer a considerable measure of protection — but bear in mind that you can charge yourself to about 30,000 volts while walking across a nylon carpet! So do not touch the inputs unless all the pins are shorted, or you have discharged yourself to earth.
NMOS & PMOS circuits are only found in particular devices like microprocessors and memory IC's, not in the standard logic circuits. With improving technology CMOS is now taking over in these devices with a consequent reduction in power consumption with all the added advantages such as battery operation.
In conclusion, if you intend to take up electronic experimentation at all seriously, then a good selection of data books is a must. This is the only real way to find out who makes what, and can save you a lot of time. There is really no point in constructing a circuit out of 10 ICs when one commonly available chip may well do the whole job for you — unless of course you simply want to prove you can do it.
Feature by Tim Edwards
mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.
If you value this resource, you can support this project - it really helps!