Professional Documents
Culture Documents
https://www.electronics-tutorials.ws/combination/comb_7.html
Binary Adders are arithmetic circuits in the form of half-adders and full-adders used to add together
two binary digits
Another common and very useful combinational logic circuit which can be constructed
using just a few basic logic gates allowing it to add together two or more binary numbers is
the Binary Adder.
A basic Binary Adder circuit can be made from standard AND and Ex-OR gates allowing
us to “add” together two single bit binary numbers, A and B.
The addition of these two digits produces an output called the SUM of the addition and a
second output called the CARRY or Carry-out, ( COUT ) bit according to the rules for binary
addition. One of the main uses for the Binary Adder is in arithmetic and counting circuits.
Consider the simple addition of the two denary (base 10) numbers below.
From our math lessons at school, we learnt that each number column is added together
starting from the right hand side and that each digit has a weighted value depending upon
its position within the columns.
When each column is added together a carry is generated if the result is greater or equal
to 10, the base number. This carry is then added to the result of the addition of the next
column to the left and so on, simple school math’s addition, add the numbers and carry.
The adding of binary numbers is exactly the same idea as that for adding together decimal
numbers but this time a carry is only generated when the result in any column is greater or
equal to “2”, the base number of binary. In other words 1 + 1 creates a carry.
Binary Addition
Binary Addition follows these same basic rules as for the denary addition above except
in binary there are only two digits with the largest digit being “1”. So when adding binary
numbers, a carry out is generated when the “SUM” equals or is greater than two (1+1) and
this becomes a “CARRY” bit for any subsequent addition being passed over to the next
column for addition and so on. Consider the single bit addition below.
Binary Addition of Two Bits
When the two single bits, A and B are added together, the addition of “0 + 0”, “0 + 1” and
“1 + 0” results in either a “0” or a “1” until you get to the final column of “1 + 1” then the
sum is equal to “2”. But the number two does not exists in binary however, 2 in binary is
equal to 10, in other words a zero for the sum plus an extra carry bit.
Then the operation of a simple adder requires two data inputs producing two outputs, the
Sum (S) of the equation and a Carry (C) bit as shown.
For the simple 1-bit addition problem above, the resulting carry bit could be ignored but
you may have noticed something else with regards to the addition of these two bits, the
sum of their binary addition resembles that of an Exclusive-OR Gate. If we label the two
bits as A and B then the resulting truth table is the sum of the two bits but without the final
carry.
B A S
0 0 0
0 1 1
2-input Ex-OR Gate
1 0 1
1 1 0
We can see from the truth table above, that an Exclusive-OR gate only produces an
output “1” when either input is at logic “1”, but not both the same as for the binary addition
of the previous two bits. However in order to perform the addition of two numbers,
microprocessors and electronic calculators require the extra carry bit to correctly calculate
the equations so we need to rewrite the previous summation to include two-bits of output
data as shown below.
From the above equations we now know that an Exclusive-OR gate will only produce an
output “1” when “EITHER” input is at logic “1”, so we need an additional output to produce
the carry bit when “BOTH” inputs A and B are at logic “1”. One digital gate that fits the bill
perfectly producing an output “1” when both of its inputs A and B are “1” (HIGH) is the
standard AND Gate.
B A C
0 0 0
0 1 0
2-input AND Gate
1 0 0
1 1 1
By combining the Exclusive-OR gate with the AND gate results in a simple digital binary
adder circuit known commonly as the “Half Adder” circuit.
B A SUM CARRY
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
From the truth table of the half adder we can see that the SUM (S) output is the result of
the Exclusive-OR gate and the Carry-out (Cout) is the result of the AND gate. Then the
Boolean expression for a half adder is as follows.
For the SUM bit:
SUM = A XOR B = A ⊕ B
For the CARRY bit:
CARRY = A AND B = A.B
One major disadvantage of the Half Adder circuit when used as a binary adder, is that
there is no provision for a “Carry-in” from the previous circuit when adding together
multiple data bits.
For example, suppose we want to add together two 8-bit bytes of data, any resulting carry
bit would need to be able to “ripple” or move across the bit patterns starting from the least
significant bit (LSB). The most complicated operation the half adder can do is “1 + 1” but
as the half adder has no carry input the resultant added value would be incorrect. One
simple way to overcome this problem is to use a Full Adder type binary adder circuit.
Then the full adder is a logical circuit that performs an addition operation on three binary
digits and just like the half adder, it also generates a carry out to the next addition column.
Then a Carry-in is a possible carry from a less significant digit, while a Carry-
out represents a carry to a more significant digit.
In many ways, the full adder can be thought of as two half adders connected together,
with the first half adder passing its carry to the second half adder as shown.
As the full adder circuit above is basically two half adders connected together, the truth
table for the full adder includes an additional column to take into account the Carry-
in, CINinput as well as the summed output, S and the Carry-out, COUT bit.
Full Adder Truth Table with Carry
Symbol Truth Table
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
One main disadvantage of “cascading” together 1-bit binary adders to add large binary
numbers is that if inputs A and B change, the sum at its output will not be valid until any
carry-input has “rippled” through every full adder in the chain because the MSB (most
significant bit) of the sum has to wait for any changes from the carry input of the LSB (less
significant bit). Consequently, there will be a finite delay before the output of the adder
responds to any change in its inputs resulting in a accumulated delay.
When the size of the bits being added is not too large for example, 4 or 8 bits, or the
summing speed of the adder is not important, this delay may not be important. However,
when the size of the bits is larger for example 32 or 64 bits used in multi-bit adders, or
summation is required at a very high clock speed, this delay may become prohibitively
large with the addition processes not being completed correctly within one clock cycle.
This unwanted delay time is called Propagation delay. Also another problem called
“overflow” occurs when an n-bit adder adds two parallel numbers together whose sum is
greater than or equal to 2n
One solution is to generate the carry-input signals directly from the A and B inputs rather
than using the ripple arrangement above. This then produces another type of binary adder
circuit called a Carry Look Ahead Binary Adder where the speed of the parallel adder
can be greatly improved using carry-look ahead logic.
The advantage of carry look ahead adders is that the length of time a carry look ahead
adder needs in order to produce the correct SUM is independent of the number of data
bits used in the operation, unlike the cycle time a parallel ripple adder needs to complete
the SUM which is a function of the total number of bits in the addend.
4-bit full adder circuits with carry look ahead features are available as standard IC
packages in the form of the TTL 4-bit binary adder 74LS83 or the 74LS283 and the CMOS
4008 which can add together two 4-bit binary numbers and generate a SUM and
a CARRYoutput as shown.
A Display Decoder is a combinational circuit which decodes and n-bit input value into a number of
output lines to drive a display
A Digital Decoder IC, is a device which converts one digital format into another and one
of the most commonly used devices for doing this is called the Binary Coded Decimal
(BCD) to 7-Segment Display Decoder.
7-segment LED (Light Emitting Diode) or LCD (Liquid Crystal Display) type displays,
provide a very convenient way of displaying information or digital data in the form of
numbers, letters or even alpha-numerical characters.
Typically 7-segment displays consist of seven individual coloured LED’s (called the
segments), within one single display package. In order to produce the required numbers
or HEX characters from 0 to 9 and A to F respectively, on the display the correct
combination of LED segments need to be illuminated and BCD to 7-segment Display
Decoders such as the 74LS47 do just that.
A standard 7-segment LED display generally has eight (8) input connections, one for each
LED segment and one that acts as a common terminal or connection for all the internal
display segments. Some single displays have also have an additional input pin to display
a decimal point in their lower right or left hand corner.
In electronics there are two important types of 7-segment LED digital display.
1. The Common Cathode Display (CCD) – In the common cathode display, all the
cathode connections of the LED’s are joined together to logic “0” or ground. The
individual segments are illuminated by application of a “HIGH”, logic “1” signal to the
individual Anode terminals.
2. The Common Anode Display (CAD) – In the common anode display, all the
anode connections of the LED’s are joined together to logic “1” and the individual
segments are illuminated by connecting the individual Cathode terminals to a “LOW”,
logic “0” signal.
Common Cathode and Common Anode Format
Electrical connection of the individual diodes for a common cathode display and a
common anode display and by illuminating each light emitting diode individually, they can
be made to display a variety of numbers or characters.
So in order to display the number “3” for example, segments a, b, c, d and g would need
to be illuminated. If we wanted to display a different number or letter then a different set of
segments would need to be illuminated. Then for a 7-segment display, we can produce a
truth table giving the segments that need to be illuminated in order to produce the required
character as shown below.
× × × × × × 0 × × × × × × × 8
× × 1 × × × × × × 9
× × × × × 2 × × × × × × A
× × × × × 3 × × × × × b
× × × × 4 × × × × C
× × × × × 5 × × × × × d
× × × × × × 6 × × × × × E
× × × 7 × × × × F
7-Segment Display Elements for all Numbers.
It can be seen that to display any single digit number from 0 to 9 in binary or letters
from A to F in hexadecimal, we would require seven separate segment connections plus
one additional connection for the LED’s “common” connection. Also as the segments are
basically a standard light emitting diode, the driving circuit would need to produce up to
20mA of current to illuminate each individual segment and to display the number “8”, all
seven segments would need to be lit resulting a total current of nearly 140mA, (8 x 20mA).
Obviously, the use of so many connections and power consumption is impractical for
some electronic or microprocessor based circuits and so in order to reduce the number of
signal lines required to drive just one single display, display decoders such as the BCD to
7-Segment Display Decoder and Driver IC’s are used instead.
0 0 0 0 0 0 8 1 0 0 0 8
1 0 0 0 1 1 9 1 0 0 1 9
2 0 0 1 0 2 10 1 0 1 0 Invalid
3 0 0 1 1 3 11 1 0 1 1 Invalid
4 0 1 0 0 4 12 1 1 0 0 Invalid
5 0 1 0 1 5 13 1 1 0 1 Invalid
6 0 1 1 0 6 14 1 1 1 0 Invalid
7 0 1 1 1 7 15 1 1 1 1 Invalid
The use of packed BCD allows two BCD digits to be stored within a single byte (8-bits) of
data, allowing a single data byte to hold a BCD number in the range of 00 to 99.
An example of the 4-bit BCD input ( 0100 ) representing the number “4” is given below.
In practice current limiting resistors of about 150Ω to 220Ω would be connected in series
between the decoder/driver chip and each LED display segment to limit the maximum
current flow. There are different display decoders and drivers available for the different
types of available displays, either LED or LCD. For example, the 74LS48 for common-
cathode LED types, the 74LS47 for common-anode LED types, or the CMOS CD4543 for
liquid crystal display (LCD) types.
Liquid crystal displays (LCD´s) have one major advantage over similar LED types in that
they consume much less power and nowadays, both LCD and LED displays are combined
together to form larger Dot-Matrix Alphanumeric type displays which can show letters and
characters as well as numbers in standard Red or Tri-colour outputs.
Binary Decoder
https://www.electronics-tutorials.ws/combination/comb_5.html
Binary Decoder is another combinational logic circuit constructed from individual logic gates and is
the exact opposite to that of an Encoder
The name “Decoder” means to translate or decode coded information from one format into
another, so a binary decoder transforms “n” binary input signals into an equivalent code
using 2n outputs.
Binary Decoders are another type of digital logic device that has inputs of 2-bit, 3-bit or 4-
bit codes depending upon the number of data input lines, so a decoder that has a set of
two or more bits will be defined as having an n-bit code, and therefore it will be possible to
represent 2n possible values. Thus, a decoder generally decodes a binary value into a
non-binary one by setting exactly one of its n outputs to logic “1”.
If a binary decoder receives n inputs (usually grouped as a single Binary or Boolean
number) it activates one and only one of its 2n outputs based on that input with all other
outputs deactivated.
This simple example above of a 2-to-4 line binary decoder consists of an array of
four AND gates. The 2 binary inputs labelled A and B are decoded into one of 4 outputs,
hence the description of 2-to-4 binary decoder. Each output represents one of the
miniterms of the 2 input variables, (each output = a miniterm).
The binary inputs A and B determine which output line from Q0 to Q3 is “HIGH” at logic
level “1” while the remaining outputs are held “LOW” at logic “0” so only one output can be
active (HIGH) at any one time. Therefore, whichever output line is “HIGH” identifies the
binary code present at the input, in other words it “de-codes” the binary input.
Some binary decoders have an additional input pin labelled “Enable” that controls the
outputs from the device. This extra input allows the decoders outputs to be turned “ON” or
“OFF” as required. These types of binary decoders are commonly used as “memory
address decoders” in microprocessor memory applications.
Inputs A, B, C are used to select which output on either decoder will be at logic “1” (HIGH)
and input D is used with the enable input to select which encoder either the first or second
will output the “1”.
However, there is a limit to the number of inputs that can be used for one particular
decoder, because as n increases, the number of AND gates required to produce an output
also becomes larger resulting in the fan-out of the gates used to drive them becoming
large.
This type of active-“HIGH” decoder can be implemented using just Inverters, ( NOT
Gates ) and AND gates. It is convenient to use an AND gate as the basic decoding
element for the output because it produces a “HIGH” or logic “1” output only when all of its
inputs are logic “1”.
But some binary decoders are constructed using NAND gates instead of AND gates for
their decoded output, since NAND gates are cheaper to produce than AND’s as they
require fewer transistors to implement within their design.
The use of NAND gates as the decoding element, results in an active-“LOW” output while
the rest will be “HIGH”. As a NAND gate produces the AND operation with an inverted
output, the NAND decoder looks like this with its inverted truth table.
2-to-4 Line NAND Binary Decoder
Then for the NAND decoder, only one output can be LOW and equal to logic “0” at any
given time, with all the other outputs being HIGH at logic “1”.
Decoders are also available with an additional “Enable” input pin which allows the
decoded output to be turned “ON” or “OFF” by applying a logic “1” or logic “0” respectively
to it. So for example, when the enable input is at logic level “0”, (EN = 0) all outputs are
“OFF” at logic “0” (for AND gates) regardless of the state of the inputs A and B.
Generally to implement this enabling function the 2-input AND or NAND gates are
replaced with 3-input AND or NAND gates. The additional input pin represents the enable
function.
The binary decoder requires only 3 address lines, (A0 to A2) to select each one of the 8
chips (the lower part of the address), while the remaining 8 address lines (A3 to A10) select
the correct memory location on that chip (the upper part of the address).
Having selected a memory location using the address bus, the information at the particular
internal memory location is sent to a common “Data Bus” for use by the microprocessor.
This is of course a simple example but the principals remain the same for all types of
memory chips or modules.
Binary Decoders are very useful devices for converting one digital format to another,
such as binary or BCD type data into decimal or octal etc and commonly available
decoder IC’s are the TTL 74LS138 3-to-8 line binary decoder or the 74ALS154 4-to-16
line decoder. They are also very useful for interfacing to 7-segment displays such as the
TTL 74LS47 which we will look at in the next tutorial.
Priority Encoder
https://www.electronics-tutorials.ws/combination/comb_4.html
Priority Encoders take all of their data inputs one at a time and converts them into an equivalent
binary code at its output
Unlike a multiplexer that selects one individual data input line and then sends that data to
a single output line or switch, Digital Encoder more commonly called a Binary
Encodertakes ALL its data inputs one at a time and then converts them into a single
encoded output. So we can say that a binary encoder, is a multi-input combinational logic
circuit that converts the logic level “1” data at its inputs into an equivalent binary code at its
output.
Generally, digital encoders produce outputs of 2-bit, 3-bit or 4-bit codes depending upon
the number of data input lines. An “n-bit” binary encoder has 2n input lines and n-bitoutput
lines with common types that include 4-to-2, 8-to-3 and 16-to-4 line configurations.
The output lines of a digital encoder generate the binary equivalent of the input line whose
value is equal to “1” and are available to encode either a decimal or hexadecimal input
pattern to typically a binary or “B.C.D” (binary coded decimal) output code.
One of the main disadvantages of standard digital encoders is that they can generate the
wrong output code when there is more than one input present at logic level “1”. For
example, if we make inputs D1 and D2 HIGH at logic “1” both at the same time, the
resulting output is neither at “01” or at “10” but will be at “11” which is an output binary
number that is different to the actual input present. Also, an output code of all logic “0”s
can be generated when all of its inputs are at “0” OR when input D0 is equal to one.
One simple way to overcome this problem is to “Prioritise” the level of each input pin. So if
there is more than one input at logic level “1” at the same time, the actual output code
would only correspond to the input with the highest designated priority. Then this type of
digital encoder is known commonly as a Priority Encoder or P-encoder for short.
Priority Encoder
The Priority Encoder solves the problems mentioned above by allocating a priority level
to each input. The priority encoders output corresponds to the currently active input which
has the highest priority. So when an input with a higher priority is present, all other inputs
with a lower priority will be ignored.
The priority encoder comes in many different forms with an example of an 8-input priority
encoder along with its truth table shown below.
Priority encoders are available in standard IC form and the TTL 74LS148 is an 8-to-3 bit
priority encoder which has eight active LOW (logic “0”) inputs and provides a 3-bit code of
the highest ranked input at its output.
Priority encoders output the highest order input first for example, if input lines “D2“, “D3”
and “D5” are applied simultaneously the output code would be for input “D5” (“101”) as
this has the highest order out of the 3 inputs. Once input “D5” had been removed the next
highest output code would be for input “D3” (“011”), and so on.
The truth table for a 8-to-3 bit priority encoder is given as:
D7 D6 D5 D4 D3 D2 D1 D0 Q2 Q1 Q0
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 X 0 0 1
0 0 0 0 0 1 X X 0 1 0
0 0 0 0 1 X X X 0 1 1
0 0 0 1 X X X X 1 0 0
0 0 1 X X X X X 1 0 1
0 1 X X X X X X 1 1 0
1 X X X X X X X 1 1 1
Output Q1
Output Q2
Then the final Boolean expression for the priority encoder including the zero inputs is
defined as:
In practice these zero inputs would be ignored allowing the implementation of the final
Boolean expression for the outputs of the 8-to-3 priority encoder. We can constructed a
simple encoder from the expression above using individual OR gates as follows.
Keyboard Encoder
Priority encoders can be used to reduce the number of wires needed in a particular
circuits or application that have multiple inputs. For example, assume that a
microcomputer needs to read the 104 keys of a standard QWERTY keyboard where only
one key would be pressed either “HIGH” or “LOW” at any one time.
One way would be to connect all 104 wires from the individual keys on the keyboard
directly to the computers input but this would be impractical for a small home PC. Another
alternative and better way would be to interface the keyboard to the PC using a priority
encoder.
The 104 individual buttons or keys could be encoded into a standard ASCII code of only 7-
bits (0 to 127 decimal) to represent each key or character of the keyboard and then input
as a much smaller 7-bit B.C.D code directly to the computer. Keypad encoders such as
the 74C923 20-key encoder are available to do just that.
Positional Encoders
Another more common application is in magnetic positional control as used on ships
navigation or for robotic arm positioning etc. Here for example, the angular or rotary
position of a compass is converted into a digital code by a 74LS148 8-to-3 line priority
encoder and input to the systems computer to provide navigational data and an example
of a simple 8 position to 3-bit output compass encoder is shown below. Magnets and reed
switches could be used at each compass point to indicate the needles angular position.
North 0 0 0
North-East 0 0 1
East 0 1 0
South-East 0 1 1
South 1 0 0
South-West 1 0 1
West 1 1 0
North-West 1 1 1
Interrupt Requests
Other applications especially for Priority Encoders may include detecting interrupts in
microprocessor applications. Here the microprocessor uses interrupts to allow peripheral
devices such as the disk drive, scanner, mouse, or printer etc, to communicate with it, but
the microprocessor can only “talk” to one peripheral device at a time so needs some way
of knowing when a particular peripheral device wants to communicate with it.
The processor does this by using “Interrupt Requests” or “IRQ” signals to assign priority to
all the peripheral devices to ensure that the most important peripheral device is serviced
first. The order of importance of the devices will depend upon their connection to the
priority encoder.
The demultiplexer is a combinational logic circuit designed to switch one common input line to one of
several seperate output line
The data distributor, known more commonly as a Demultiplexer or “Demux” for short, is
the exact opposite of the Multiplexer we saw in the previous tutorial.
The demultiplexer takes one single input data line and then switches it to any one of a
number of individual output lines one at a time. The demultiplexer converts a serial data
signal at the input to a parallel data at its output lines as shown below.
Output Select
Data Output
Selected
a b
0 0 A
0 1 B
1 0 C
1 1 D
The Boolean expression for this 1-to-4 Demultiplexer above with outputs A to D and data
select lines a, b is given as:
The function of the Demultiplexer is to switch one common data input line to any one of
the 4 output data lines A to D in our example above. As with the multiplexer the individual
solid state switches are selected by the binary input address code on the output select
pins “a” and “b” as shown.
Demultiplexer Output Line Selection
As with the previous multiplexer circuit, adding more address line inputs it is possible to
switch more outputs giving a 1-to-2n data line outputs.
Some standard demultiplexer IC´s also have an additional “enable output” pin which
disables or prevents the input from being passed to the selected output. Also some have
latches built into their outputs to maintain the output logic level after the address inputs
have been changed.
However, in standard decoder type circuits the address input will determine which single
data output will have the same value as the data input with all other data outputs having
the value of logic “0”.
The implementation of the Boolean expression above using individual logic gates would
require the use of six individual gates consisting of AND and NOT gates as shown.
Again, as with the previous multiplexer example, we can also use the demultiplexer to
digitally control the gain of an operational amplifier as shown.
Digitally Adjustable Amplifier Gain
The circuit above illustrates how to provide digitally controlled adjustable/variable op-amp
gain using a demultiplexer. The voltage gain of the inverting operational amplifier is
dependent upon the ratio between the input resistor, RIN and its feedback resistor, Rƒ as
determined in the Op-amp tutorials.
The digitally controlled analogue switches of the demultiplexer select an input resistor to
vary the value of Rin. The combination of these resistors will determine the overall voltage
gain of the amplifier, (Av). Then the voltage gain of the inverting operational amplifier can
be adjusted digitally simply by selecting the appropriate input resistor combination.
Standard Demultiplexer IC packages available are the TTL 74LS138 1 to 8-output
demultiplexer, the TTL 74LS139 Dual 1-to-4 output demultiplexer or the CMOS CD4514 1-
to-16 output demultiplexer.
Another type of demultiplexer is the 24-pin, 74LS154 which is a 4-bit to 16-line
demultiplexer/decoder. Here the individual output positions are selected using a 4-bit
binary coded input. Like multiplexers, demultiplexers can also be cascaded together to
form higher order demultiplexers.
Unlike multiplexers which convert data from a single data line to multiple lines and
demultiplexers which convert multiple lines to a single data line, there are devices
available which convert data to and from multiple lines and in the next tutorial about
combinational logic devices, we will look at Encoders which convert multiple input lines
into multiple output lines, converting the data from one form to another.
The Multiplexer
https://www.electronics-tutorials.ws/combination/comb_2.html
The multiplexer is a combinational logic circuit designed to switch one of several input lines to a
single common output line
Multiplexing is the generic term used to describe the operation of sending one or more
analogue or digital signals over a common transmission line at different times or speeds
and as such, the device we use to do just that is called a Multiplexer.
The multiplexer, shortened to “MUX” or “MPX”, is a combinational logic circuit designed to
switch one of several input lines through to a single common output line by the application
of a control signal. Multiplexers operate like very fast acting multiple position rotary
switches connecting or controlling multiple input lines called “channels” one at a time to
the output.
Multiplexers, or MUX’s, can be either digital circuits made from high speed logic gates
used to switch digital or binary data or they can be analogue types using transistors,
MOSFET’s or relays to switch one of the voltage or current inputs through to a single
output.
The most basic type of multiplexer device is that of a one-way rotary switch as shown.
The rotary switch, also called a wafer switch as each layer of the switch is known as a
wafer, is a mechanical device whose input is selected by rotating a shaft. In other words,
the rotary switch is a manual switch that you can use to select individual data or signal
lines simply by turning its inputs “ON” or “OFF”. So how can we select each data input
automatically using a digital device.
In digital electronics, multiplexers are also known as data selectors because they can
“select” each input line, are constructed from individual Analogue Switches encased in a
single IC package as opposed to the “mechanical” type selectors such as normal
conventional switches and relays.
They are used as one method of reducing the number of logic gates required in a circuit
design or when a single data line or data bus is required to carry two or more different
digital signals. For example, a single 8-channel multiplexer.
Generally, the selection of each input line in a multiplexer is controlled by an additional set
of inputs called control lines and according to the binary condition of these control inputs,
either “HIGH” or “LOW” the appropriate data input is connected directly to the output.
Normally, a multiplexer has an even number of 2n data input lines and a number of
“control” inputs that correspond with the number of data inputs.
Note that multiplexers are different in operation to Encoders. Encoders are able to switch
an n-bit input pattern to multiple output lines that represent the binary coded (BCD) output
equivalent of the active input.
We can build a simple 2-line to 1-line (2-to-1) multiplexer from basic logic NAND gates as
shown.
The input A of this simple 2-1 line multiplexer circuit constructed from standard NAND
gates acts to control which input ( I0 or I1 ) gets passed to the output at Q.
From the truth table above, we can see that when the data select input, A is LOW at logic
0, input I1 passes its data through the NAND gate multiplexer circuit to the output, while
input I0 is blocked. When the data select A is HIGH at logic 1, the reverse happens and
now input I0 passes data to the output Q while input I1 is blocked.
So by the application of either a logic “0” or a logic “1” at A we can select the appropriate
input, I0 or I1 with the circuit acting a bit like a single pole double throw (SPDT) switch.
As we only have one control line, (A) then we can only switch 21 inputs and in this simple
example, the 2-input multiplexer connects one of two 1-bit sources to a common output,
producing a 2-to-1-line multiplexer. We can confirm this in the following Boolean
expression.
and for our 2-input multiplexer circuit above, this can be simplified too:
We can increase the number of data inputs to be selected further simply by following the
same procedure and larger multiplexer circuits can be implemented using smaller 2-to-1
multiplexers as their basic building blocks. So for a 4-input multiplexer we would therefore
require two data select lines as 4-inputs represents 22 data control lines give a circuit with
four inputs, I0, I1, I2, I3 and two data select lines A and B as shown.
The Boolean expression for this 4-to-1 Multiplexer above with inputs A to D and data
select lines a, b is given as:
In this example at any one instant in time only ONE of the four analogue switches is
closed, connecting only one of the input lines A to D to the single output at Q. As to which
switch is closed depends upon the addressing input code on lines “a” and “b“.
So for this example to select input B to the output at Q, the binary input address would
need to be “a” = logic “1” and “b” = logic “0”. Thus we can show the selection of the data
through the multiplexer as a function of the data select bits as shown.
Adding more control address lines, (n) will allow the multiplexer to control more inputs as it
can switch 2n inputs but each control line configuration will connect only ONE input to the
output.
Then the implementation of the Boolean expression above using individual logic gates
would require the use of seven individual gates consisting of AND, OR and NOT gates as
shown.
4 Channel Multiplexer using Logic Gates
Multiplexer Symbol
Multiplexers are not limited to just switching a number of different input lines or channels
to one common single output. There are also types that can switch their inputs to multiple
outputs and have arrangements or 4-to-2, 8-to-3 or even 16-to-4 etc configurations and an
example of a simple Dual channel 4 input multiplexer (4-to-2) is given below:
Here in this example the 4 input channels are switched to 2 individual output lines but
larger arrangements are also possible. This simple 4-to-2 configuration could be used for
example, to switch audio signals for stereo pre-amplifiers or mixers.
Here, the voltage gain of the inverting operational amplifier is dependent upon the ratio
between the input resistor, RIN and its feedback resistor, Rƒ as determined in the Op-amp
tutorials.
A single 4-channel (Quad) SPST switch configured as a 4-to-1 channel multiplexer is
connected in series with the resistors to select any feedback resistor to vary the value
of Rƒ. The combination of these resistors will determine the overall voltage gain of the
amplifier, (Av). Then the voltage gain of the amplifier can be adjusted digitally by simply
selecting the appropriate resistor combination.
Digital multiplexers are sometimes also referred to as “Data Selectors” as they select the
data to be sent to the output line and are commonly used in communications or high
speed network switching circuits such as LAN´s and Ethernet applications.
Some multiplexer IC´s have a single inverting buffer (NOT Gate) connected to the output
to give a positive logic output (logic “1”, HIGH) on one terminal and a complimentary
negative logic output (logic “0”, LOW) on another different terminal.
It is possible to make simple multiplexer circuits from standard AND and OR gates as we
have seen above, but commonly multiplexers/data selectors are available as standard i.c.
packages such as the common TTL 74LS151 8-input to 1 line multiplexer or the TTL
74LS153 Dual 4-input to 1 line multiplexer. Multiplexer circuits with much higher number of
inputs can be obtained by cascading together two or more smaller devices.
Multiplexer Summary
Then we can see that Multiplexers are switching circuits that just switch or route signals
through themselves, and being a combinational circuit they are memoryless as there is no
signal feedback path. The multiplexer is a very useful electronic circuit that has uses in
many different applications such as signal routing, data communications and data bus
control applications.
When used with a demultiplexer, parallel data can be transmitted in serial form via a single
data link such as a fibre-optic cable or telephone line and converted back into parallel data
once again. The advantage is that only one serial data line is required instead of multiple
parallel data lines. Therefore, multiplexers are sometimes referred to as “data selectors”,
as they select the data to the line.
Multiplexers can also be used to switch either analogue, digital or video signals, with the
switching current in analogue power circuits limited to below 10mA to 20mA per channel in
order to reduce heat dissipation.
In the next tutorial about combinational logic devices, we will look at the reverse of
the Multiplexer called the Demultiplexer which takes a single input line and connects it to
multiple output lines.
Combinational Logic Circuits
https://www.electronics-tutorials.ws/combination/comb_1.html
Combinational Logic Circuits are memory-less digital logic circuits whose output at any instant in time
depends only on the combination of its inputs
Unlike Sequential Logic Circuits whose outputs are dependant on both their present inputs
and their previous output state giving them some form of Memory. The outputs
of Combinational Logic Circuits are only determined by the logical function of their
current input state, logic “0” or logic “1”, at any given instant in time.
The result is that combinational logic circuits have no feedback, and any changes to the
signals being applied to their inputs will immediately have an effect at the output. In other
words, in a Combinational Logic Circuit, the output is dependant at all times on the
combination of its inputs. Thus a combinational circuit is memoryless.
So if one of its inputs condition changes state, from 0-1 or 1-0, so too will the resulting
output as by default combinational logic circuits have “no memory”, “timing” or “feedback
loops” within their design.
Combinational Logic
Combinational Logic Circuits are made up from basic logic NAND, NOR or NOT gates
that are “combined” or connected together to produce more complicated switching circuits.
These logic gates are the building blocks of combinational logic circuits. An example of a
combinational circuit is a decoder, which converts the binary code data present at its input
into a number of different output lines, one at a time producing an equivalent decimal code
at its output.
Combinational logic circuits can be very simple or very complicated and any combinational
circuit can be implemented with only NAND and NOR gates as these are classed as
“universal” gates.
The three main ways of specifying the function of a combinational logic circuit are:
1. Boolean Algebra – This forms the algebraic expression showing the operation of
the logic circuit for each input variable either True or False that results in a logic “1”
output.
2. Truth Table – A truth table defines the function of a logic gate by providing a
concise list that shows all the output states in tabular form for each possible combination
of input variable that the gate could encounter.
3. Logic Diagram – This is a graphical representation of a logic circuit that shows the
wiring and connections of each individual logic gate, represented by a specific graphical
symbol, that implements the logic circuit.
and all three of these logic circuit representations are shown below.
As combinational logic circuits are made up from individual logic gates only, they can also
be considered as “decision making circuits” and combinational logic is about combining
logic gates together to process two or more signals in order to produce at least one output
signal according to the logical function of each logic gate. Common combinational circuits
made up from individual logic gates that carry out a desired application
includeMultiplexers, De-multiplexers, Encoders, Decoders, Full and Half Adders etc.
One of the most common uses of combinational logic is in Multiplexer and De-multiplexer
type circuits. Here, multiple inputs or outputs are connected to a common signal line and
logic gates are used to decode an address to select a single data input or output switch.
A multiplexer consist of two separate components, a logic decoder and some solid state
switches, but before we can discuss multiplexers, decoders and de-multiplexers in more
detail we first need to understand how these devices use these “solid state switches” in
their design.
Solid State Switches
Standard TTL logic devices made up from Transistors can only pass signal currents in one
direction only making them “uni-directional” devices and poor imitations of conventional
electro-mechanical switches or relays. However, some CMOS switching devices made up
from FET’s act as near perfect “bi-directional” switches making them ideal for use as solid
state switches.
Solid state switches come in a variety of different types and ratings, and there are many
different applications for using solid state switches. They can basically be sub-divided into
3 different main groups for switching applications and in this combinational logic section
we will only look at the Analogue type of switch but the principal is the same for all types
including digital.
Contact Types
Just like mechanical switches, analogue switches come in a variety of forms or contact
types, depending on the number of “poles” and “throws” they offer. Thus, terms such as
“SPST” (single-pole single throw) and “SPDT” (single-pole double-throw) also apply to
solid state analogue switches with “make-before-break” and “break-before-make”
configurations available.
Individual analogue switches can be grouped together into standard IC packages to form
devices with multiple switching configurations of SPST (single-pole single-throw) and
SPDT (single-pole double-throw) as well as multi channel multiplexers.
The most common and simplest analogue switch in a single IC package is the 74HC4066
which has 4 independent bi-directional “ON/OFF” Switches within a single package but the
most widely used variants of the CMOS analogue switch are those described as “Multi-
way Bilateral Switches” otherwise known as the “Multiplexer” and “De-multiplexer” IC´s
and these are discussed in the next tutorial.
The Digital Comparator is another very useful combinational logic circuit used to compare the value of
two binary digits
Digital or Binary Comparators are made up from standard AND, NOR and NOT gates that
compare the digital signals present at their input terminals and produce an output
depending upon the condition of those inputs.
For example, along with being able to add and subtract binary numbers we need to be
able to compare them and determine whether the value of input A is greater than, smaller
than or equal to the value at input B etc. The digital comparator accomplishes this using
several logic gates that operate on the principles of Boolean Algebra. There are two main
types of Digital Comparator available and these are.
1. Identity Comparator – an Identity Comparator is a digital comparator with only one
output terminal for when A = B, either A = B = 1 (HIGH) or A = B = 0 (LOW)
2. Magnitude Comparator – a Magnitude Comparator is a digital comparator which has
three output terminals, one each for equality, A = B greater than, A > B and less
than A < B
The purpose of a Digital Comparator is to compare a set of variables or unknown
numbers, for example A (A1, A2, A3, …. An, etc) against that of a constant or unknown
value such as B (B1, B2, B3, …. Bn, etc) and produce an output condition or flag
depending upon the result of the comparison. For example, a magnitude comparator of
two 1-bits, (Aand B) inputs would produce the following three output conditions when
compared to each other.
Then the operation of a 1-bit digital comparator is given in the following Truth Table.
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
You may notice two distinct features about the comparator from the above truth table.
Firstly, the circuit does not distinguish between either two “0” or two “1”‘s as an output A =
B is produced when they are both equal, either A = B = “0” or A = B = “1”. Secondly, the
output condition for A = B resembles that of a commonly available logic gate,
the Exclusive-NOR or Ex-NOR function (equivalence) on each of the n-
bits giving: Q = A ⊕ B
Digital comparators actually use Exclusive-NOR gates within their design for comparing
their respective pairs of bits. When we are comparing two binary or BCD values or
variables against each other, we are comparing the “magnitude” of these values, a logic
“0” against a logic “1” which is where the term Magnitude Comparator comes from.
As well as comparing individual bits, we can design larger bit comparators by cascading
together n of these and produce a n-bit comparator just as we did for the n-bit adder in the
previous tutorial. Multi-bit comparators can be constructed to compare whole binary or
BCD words to produce an output if one word is larger, equal to or less than the other.
A very good example of this is the 4-bit Magnitude Comparator. Here, two 4-bit words
(“nibbles”) are compared to each other to produce the relevant output with one word
connected to inputs A and the other to be compared against connected to input B as
shown below.
4-bit Magnitude Comparator
Some commercially available digital comparators such as the TTL 74LS85 or CMOS 4063
4-bit magnitude comparator have additional input terminals that allow more individual
comparators to be “cascaded” together to compare words larger than 4-bits with
magnitude comparators of “n”-bits being produced. These cascading inputs are connected
directly to the corresponding outputs of the previous comparator as shown to compare 8,
16 or even 32-bit words.
When comparing large binary or BCD numbers like the example above, to save time the
comparator starts by comparing the highest-order bit (MSB) first. If equality exists, A = B
then it compares the next lowest bit and so on until it reaches the lowest-order bit, (LSB).
If equality still exists then the two numbers are defined as being equal.
If inequality is found, either A > B or A < B the relationship between the two numbers is
determined and the comparison between any additional lower order bits stops. Digital
Comparator are used widely in Analogue-to-Digital converters, (ADC) and Arithmetic
Logic Units, (ALU) to perform a variety of arithmetic operations.
Binary Subtractor
https://www.electronics-tutorials.ws/combination/binary-subtractor.html
The Binary Subtractor is another type of combinational arithmetic circuit that produces an output
which is the subtraction of two binary numbers
As their name implies, a Binary Subtractor is a decision making circuit that subtracts two
binary numbers from each other, for example, X – Y to find the resulting difference
between the two numbers.
Unlike the Binary Adder which produces a SUM and a CARRY bit when two binary
numbers are added together, the binary subtractor produces a DIFFERENCE, D by using
a BORROW bit, B from the previous column. Then obviously, the operation of subtraction
is the opposite to that of addition.
We learnt from our math lessons at school that the minus sign, “–” is used for a
subtraction calculation, and when one number is subtracted from another, a borrow is
required if the subtrahend is greater than the minuend. Consider the simple subtraction of
the two denary (base 10) numbers below.
We can not directly subtract 8 from 3 in the first column as 8 is greater than 3, so we have
to borrow a 10, the base number, from the next column and add it to the minuend to
produce 13 minus 8. This “borrowed” 10 is then return back to the subtrahend of the next
column once the difference is found. Simple school math’s, borrow a 10 if needed, find the
difference and return the borrow.
The subtraction of one binary number from another is exactly the same idea as that for
subtracting two decimal numbers but as the binary number system is a Base-2 numbering
system which uses “0” and “1” as its two independent digits, large binary numbers which
are to be subtracted from each other are therefore represented in terms of “0’s” and “1’s”.
Binary Subtraction
Binary Subtraction can take many forms but the rules for subtraction are the same
whichever process you use. As binary notation only has two digits, subtracting a “0” from a
“0” or a “1” leaves the result unchanged as 0-0 = 0 and 1-0 = 1. Subtracting a “1” from a
“1” results in a “0”, but subtracting a “1” from a “0” requires a borrow. In other
words 0 – 1requires a borrow.
Binary Subtraction of Two Bits
For the simple 1-bit subtraction problem above, if the borrow bit is ignored the result of
their binary subtraction resembles that of an Exclusive-OR Gate. To prevent any
confusion in this tutorial between a binary subtractor input labelled, B and the resulting
borrow bit output from the binary subtractor also being labelled, B, we will label the two
input bits as X for the minuend and Y for the subtrahend. Then the resulting truth table is
the difference between the two input bits of a single binary subtractor is given as:
Y X Q
0 0 0
0 1 1
1 1 0
As with the Binary Adder, the difference between the two digits is only a “1” when these
two inputs are not equal as given by the Ex-OR expression. However, we need an
additional output to produce the borrow bit when input X = 0 and Y = 1. Unfortunately
there are no standard logic gates that will produce an output for this particular combination
of X and Y inputs.
But we know that an AND Gate produces an output “1” when both of its inputs X and Yare
“1” (HIGH) so if we use an inverter or NOT Gate to complement the input X before it is fed
to the AND gate, we can produce the required borrow output when X = 0 and Y = 1 as
shown below.
Then by combining the Exclusive-OR gate with the NOT-AND combination results in a
simple digital binary subtractor circuit known commonly as the Half Subtractor as shown.
A Half Subtractor Circuit
A half subtractor is a logical circuit that performs a subtraction operation on two binary
digits. The half subtractor produces a sum and a borrow bit for the next stage.
Y X DIFFERENCE BORROW
0 0 0 0
0 1 1 0
1 0 1 1
1 1 0 0
From the truth table of the half subtractor we can see that the DIFFERENCE (D) output is
the result of the Exclusive-OR gate and the Borrow-out (Bout) is the result of the NOT-
AND combination. Then the Boolean expression for a half subtractor is as follows.
If we compare the Boolean expressions of the half subtractor with a half adder, we can
see that the two expressions for the SUM (adder) and DIFFERENCE (subtractor) are
exactly the same and so they should be because of the Exclusive-OR gate function. The
two Boolean expressions for the binary subtractor BORROW is also very similar to that for
the adders CARRY. Then all that is needed to convert a half adder to a half subtractor is
the inversion of the minuend input X.
One major disadvantage of the Half Subtractor circuit when used as a binary subtractor, is
that there is no provision for a “Borrow-in” from the previous circuit when subtracting
multiple data bits from each other. Then we need to produce what is called a “full binary
subtractor” circuit to take into account this borrow-in input from a previous circuit.
Then the combinational circuit of a “full subtractor” performs the operation of subtraction
on three binary bits producing outputs for the difference D and borrow B-out. Just like the
binary adder circuit, the full subtractor can also be thought of as two half subtractors
connected together, with the first half subtractor passing its borrow to the second half
subtractor as follows.
As the full subtractor circuit above represents two half subtractors cascaded together, the
truth table for the full subtractor will have eight different input combinations as there are
three input variables, the data bits and the Borrow-in, BIN input. Also includes the
difference output, D and the Borrow-out, BOUT bit.
Full Subtractor Truth Table
Symbol Truth Table
0 0 0 0 0
0 0 1 1 0
0 1 0 1 1
0 1 1 0 0
1 0 0 1 1
1 0 1 0 0
1 1 0 0 1
1 1 1 1 1
Then we can use a 4-bit full-adder ICs such as the 74LS283 and CD4008 to perform
subtraction simply by using two’s complement on the subtrahend, B inputs as X – Y is the
same as saying, X + (-Y) which equals X plus the two’s complement of Y.
If we wanted to use the 4-bit adder for addition once again, all we would need to do is set
the carry-in (CIN) input LOW at logic “0”. Because we can use the 4-bit adder IC such as
the 74LS83 or 74LS283 as a full-adder or a full-subtractor they are available as a single
adder/subtractor circuit with a single control input for selecting between the two
operations.
Bus Transceiver
https://www.electronics-tutorials.ws/combination/bus-transceiver.html
A Transceiver can be used to provide bidirectional, input or output control, of either digital
or analogue devices to a common shared data bus. Unlike the buffer, transceivers are
bidirectional devices which allow data to flow through them in either direction.
Thus their name “transceiver” is a portmanteau word coming from the amalgamation of
the two words trans-mitter and re-ceive (transmitter/receiver). Transceivers are also
known by the names of: send/receive or driver/receiver devices.
In the Digital Buffer Tutorial, we saw that a buffer performs no inversion or decision
making capabilities, unlike digital logic gates with two or more inputs, but instead produces
an output condition which matches exactly that of its input. Thus a buffer is a “non-
inverting” device producing the Boolean expression of: Q = A.
Digital Buffer
A Digital Buffer like the one shown on the left, is a unidirectional device, that is the signal
passes through them in one direction only, from input “A” to the output at “Q“.
Thus, when input A is at logic “1”, output Q is at logic “1”, and when input A is at logic “0”,
output Q is at logic “0” for a positive logic device such as the CMOS 74HC4050 Hex Buffer
Gate.
Buffers can be used to isolate other gates or circuit stages from each other preventing the
impedance or operation of one circuit from affecting the impedance or operation of
another. Also on their own, buffers can be used as drivers for high current loads such as
transistor switches because their output drive capability (fan-out) is generally much higher
than their input signal requirements. For example, the TTL 74LS07 Hex buffer/driver with
open collector, high-voltage (30 volts) outputs.
TTL 74LS07 Digital Buffer
The digital non-inverting buffer function can also be made using spare logic AND, or
logic OR gates or by using pairs of NOT gates (inverters) as shown.
One of the disadvantages of a single input digital buffer is that the output at Q will always
be at the same logic level as the input possibly affecting whatever circuit or device is
connected to the buffers output terminal. One way to overcome this is to turn the basic
buffer into a 3-State Buffer, more commonly known as a Tri-state Buffer.
The tri-state buffer’s symbol is very similar to the standard buffer symbol above but with
the addition of a second input representing the enable/disable control function. When the
enable (EN) input is at a logic level “1” (for positive logic), it acts as a normal buffer
allowing the input signal, A to pass directly to the output at Q. Whether it is a logic “0” or a
logic “1”.
When the enable input is at logic “0”, the tristate buffer is activated into its third state and
disables or turns “OFF” its output producing an open circuit condition. This third condition
is neither at a logic “1” (high) or logic “0” (low), but instead gives an output state that is at a
very high impedance, High-Z, more commonly written as: Hi-Z.
Thus a tri-state buffer has two logic state inputs, “0” or a “1” but can produce three
different output states, “0”, “1” or “Hi-Z” which is why it is called a “Tri” or “3-state” device.
Note that this third state is NOT equal to a logic level “0” or a “1”, but is an high impedance
state as its output is electrically disconnected.
Then we can correctly state for a positively enabled tri-state buffer that:
If the enable signal is HIGH, logic “1”, the input signal of the buffer gate is passed
directly to its output.
If the enable signal is LOW, logic “0”, the output of the buffer gate acts like an open
circuit, that is, high impedance, (Hi-Z).
and we can present the truth table for a tri-state buffer as:
Enable IN OUT
0 0 Hi-Z
0 1 Hi-Z
1 0 0
Tri-state Buffer
1 1 1
Tri-state Buffers are available in integrated form as quad, hex or octal buffer/drivers such
as the TTL 74LS244 as shown.
74LS244 Octal Tri-state Buffer
Notice that the eight buffers are configured into two groups of four with the first group
(A1 to A4) being controlled by enable input, CA, and the second group (A5 to A8) being
controlled by the enable input, CB. The 74LS244 has very high sink and source current
capabilities if required to switch transistor loads.
The outputs from each tri-state buffer are connected to a common wire bus but their
enable inputs are connected to a binary decoder. The decoder guarantees that only one
tri-state buffer will be active at any one time, due to its enable signal. This allows the data
of the active buffer to pass directly onto the common bus while the outputs of the other
non-enabled buffers are effectively disconnected and in their high-impedance state. Thus
which buffer is connected to the common line will depending on the binary value of the
decoders select inputs.
Therefore, no more than one tri-state buffer can be in an “active state” at any given time.
You may have noticed that the possible combination of different data inputs connected to
a single output line above resembles that of a 4-to-1 line multiplexer, and you would be
right, multiplexer circuits can be easily constructed using tri-state buffers.
Any tri-state buffer element can easily be converted into a normal digital buffer by simply
connecting their enable (EN) input directly to +Vcc or ground, depending on the tri-state
buffer used. Thus, the output is permanently enabled so any input signal present at “A” will
pass straight through the buffer to the output at “Q“.
We have seen thus far, that we can use tri-state buffers to send information in a uni-
directional way onto a common wire or bus. But how could we use them to send data in
both directions, that is, to send data too and receive data from a common wire bus.
Here, the two tri-state buffers are connected in parallel but in reverse from “A” to “B” with
the enable control input, EN acting more like a directional control signal thus allowing data
to be both read “from” and transmitted “to” the same data terminal.
So in this simple example, when the enable input is HIGH, (EN equals logic “1”) data is
allowed to pass from A to B via buffer 1, and when the enable input is LOW,
(EN equals logic “0”) data passes from B to A via buffer 2.
Thus the enable input “EN” acts as direction control allowing data to flow in either direction
depending upon the logic status of this control input. In this type of application a tri-state
buffer with bi-directional switching capability such as the TTL 74LS245 or the inverting
CMOS 74ALS620 can be used producing what is called a Bus Transceiver.
Bus Transceivers
Bus transceivers are tri-state bi-directional devices which allow the flow of data between
two points making them compatible with bus-oriented systems or the bi-directional (input
or output) control of interface circuitry. Bus transceivers can be inverting, the TTL
74LS242 or non-inverting, the TTL 74LS243 devices.
Thus we can use an 8-line octal transceiver to interface any input/output device to an 8-bit
data bus with the most common bus transceiver IC being used to both send and receive
data is the TTL 74LS245 given below.
74LS245 Bus Transceiver
The transmission gate is a bilateral switch consisting of NMOS and PMOS transistors controlled by
externally applied logic levels
The analogue switch is a solid-state semiconductor switch that controls the transmission
path of analogue signals. The open and closed operations of the switch positions are
usually controlled by some digital logic network, with standard analogue switches
available in many styles and configurations. For example, single or dual normally open
(NO) or normally closed (NC), single-pole single-throw (SPST), single-pole, double-throw
(SPDT) configurations etc, in much the same way as for conventional electromechanical
relays and contacts.
The switching and routing of digital and analogue signals (both voltage and current) can
easily be done using mechanical relays and their contacts, but these can be slow and
costly. The obvious choice is to use much faster acting solid state electronic switches
which use metal oxide semiconductor (MOS) analogue gates to route the signal currents
from their input to their output, with the well-known CMOS 4016B bilateral switch being the
most common example.
MOS technology uses both NMOS and PMOS devices to perform the logical switching
functions, thus allowing a digital computer or logic circuit to control the operation of these
analogue switches. CMOS devices where both NMOS and PMOS transistors are
fabricated into the same gate circuit, can pass (closed-condition) or block (open-condition)
an analogue or digital signal, depending on the digital logic level that controls it.
The type of solid-state switch which allows for a signal or data transfer in both directions is
called a Transmission Gate, or TG. But first lets consider the operation of a Field Effect
Transistor, or FET as a basic analogue switch.
Then we can see that for the n-channel (NMOS) and p-channel (PMOS) enhancement
MOSFET to operate as an open (OFF) or closed (ON) device the following conditions
must be true:
An N-channel MOSFET behaves like an closed switch when the gate-source voltage,
VGS is greater than the threshold voltage, VT. That is VGS > VT
An N-channel MOSFET behaves like an open switch when the gate-source voltage,
VGSis less than the threshold voltage, VT. That is VGS < VT
A P-channel MOSFET behaves like an closed switch when the gate-drain voltage, VGDis
less than the threshold voltage, VT. That is VGD < VT
A P-channel MOSFET behaves like an open switch when the gate-drain voltage, VGD is
greater than the threshold voltage, VT. That is VGD > VT
Note that a MOSFETs Threshold Voltage, VT is the minimum voltage applied to the gate
terminal for the main channel between the drain and source terminals to start conducting.
Also, since the eMOSFET is used mainly as a switching device, it generally operates
between its cut-off and saturation regions thus VGS acts as an ON/OFF control voltage for
the MOSFET.
An ideal analogue switch would create a short-circuit condition when closed and an open-
circuit condition when open, in a similar fashion to a mechanical switch.
However, solid-state analogue switches are not ideal as there is always some loss
associated with the conducting channel due to its resistive value when ON.
We would like to think that if we applied a signal to its input pin this would result in the
signal being identical and without loss at the output pin, and vice versa. However, while
CMOS switches do make excellent transmission gates, their “ON” state resistance, R ON
can be several ohms creating an I2*R power loss, while their “OFF” state resistance can
be several thousand ohms allowing pico amperes of current to still flow through the
channel.
Nevertheless, the ability of complementary metal-oxide semiconductor FETs to perform as
analogue switches and transmission gates remains high, and MOSFET devices, in
particular the enhancement MOSFET which requires a voltage to be applied to the gate to
turn it “ON” and zero voltage to turn it “OFF” are the most commonly used switching
transistor.
When the control voltage, VC on the gate is zero (LOW), the gate terminal will not be
positive with respect to either input terminal (drain) or the output terminal (source), thus
the transistor is in its cut-off region and the input and output terminals are isolated from
each. Then the NMOS is acting an open switch so any voltage at the input will not be
passed to the output.
When there is a positive control voltage +VC at the gate terminal, the transistor is turned
“ON” and in its saturation region acting as a closed switch. If the input voltage, VIN is
positive and greater than VC current will flow from the drain terminal to the source terminal,
thus connecting VOUT to VIN.
If however VIN becomes zero (LOW) while the gates control voltage is still positive, the
transistor channel is still open but the drain-to-source voltage, VDS is zero, so no drain
current flows through the channel and thus the output voltage is zero.
Therefore, as long as the gate control voltage, VC is HIGH, the NMOS transistor passes
the input voltage to the output. If it is LOW, the NMOS transistor is turned “OFF”, and the
output terminal is disconnected from the input. Thus, the control voltage, VC at the gate
determines whether the transistor is an “open” or “closed” as a switch.
One issue here with the NMOS switch is that the gate-to-source voltage, VGS must be
significantly greater than the channel threshold voltage to turn it fully-ON or there will be a
voltage reduction through the channel. Thus the NMOS device can only transmit a “weak”
logic “1” (HIGH) level but a strong logic “0” (LOW) without loss.
For the PMOS FET, when the control voltage, VC on the gate is zero and is thus more
negative with respect to either input terminal (source) or the output terminal (drain), the
transistor is “ON” and in its saturation region acting as a closed switch. If the input voltage,
VIN is positive and greater than VC current will flow from the source terminal to the drain
terminal, that is ID flows out of the drain thus connecting VIN to VOUT.
If the input voltage, VIN becomes zero (LOW) while the gates control voltage is still zero or
negative, the PMOS channel is still open but the source-to-drain voltage, VSD is zero, so no
current flows through the channel and thus the voltage at the output (drain) is zero.
When there is a positive control voltage +VC at the gate terminal, the channel of the PMOS
transistor is turned “OFF” and in its cut-off region acting as a open switch. Thus no drain
current, ID flows through the conducting channel.
Therefore, as long as the gate control voltage, VC is LOW (or negative), the PMOS
transistor will pass the input voltage to the output. If it is HIGH, the PMOS transistor is
turned “OFF”, and the output terminal is disconnected from the input. Thus as with the
previous NMOS device, the control voltage, VC at the gate determines whether the
transistor is an “open” or “closed” as a switch.
The problem with the PMOS switch is that the gate-to-source voltage, VGS must be
significantly less than the channel threshold voltage to turn it fully-OFF or current will still
flow through the channel. Thus the PMOS device can transmit a “strong” logic “1” (HIGH)
level without loss but a weak logic “0” (LOW).
So we can see that for an NMOS device a positive gate-to-source voltage causes current
to flow in one direction from Drain-to-Source, while for the PMOS device, a negative gate-
to-source voltage will result in current flowing in the reverse direction from Source-to-
Drain.
However, the NMOS device only passes a strong “0” but a weak “1”, while the PMOS
device passes a strong “1” but a weak “0”. Thus by combining the characteristics of the
NMOS and the PMOS devices, it is possible to transmit both a strong logic “0” or a strong
logic “1” value in either direction without any degradation. This then forms the basis of
a Transmission Gate.
Transmission Gate
Connecting PMOS and NMOS devices together in parallel we can create a basic bilateral
CMOS switch, known commonly as a “Transmission Gate”. Note that transmission gates
are quite different from conventional CMOS logic gates as the transmission gate is
symmetrical, or bilateral, that is, the input and output are interchangeable. This bilateral
operation is shown in the transmission gate symbol below which shows two superimposed
triangles pointing in opposite directions to indicate the two signal directions.
CMOS Transmission Gate
Two MOS transistors are connected back-to-back in parallel with an inverter used
between the gate of the NMOS and PMOS to provide the two complementary control
voltages. When the input control signal, VC is LOW, both the NMOS and PMOS transistors
are cut-off and the switch is open. When VC is high, both devices are biased into
conduction and the switch is closed.
Thus the transmission gate acts as a “closed” switch when VC = 1, while the gate acts as
an “open” switch when VC = 0 operating as a voltage-controlled switch. The bubble of the
symbol indicating the gate of the PMOS FET.
Control A B
1 0 0
1 1 1
0 0 Hi-Z
Transmission Gate
0 1 Hi-Z
We can see from the above truth table, that the output at B relies not only the logic level of
the input A, but also on the logic level present on the control input. Thus the logic level
value of B is defined as both A AND Control giving us the boolean expression for a
transmission gate of:
B = A.Control
Since the boolean expression of a transmission gate incorporates the logical AND
function, it is therefore possible to implement this operation using a standard 2-input AND
gate with one input being the data input while the other is the control input as shown.
One other point to consider about transmission gates, a single NMOS or a single PMOS
on its own can be used as a CMOS switch, but the combination of the two transistors in
parallel has some advantages. An FET channel is resistive so the ON-resistances of both
transistors are effectively connected in parallel.
As a FETs On-resistance is a function of the gate-to-source voltage, VGS, as one transistor
becomes less conducting due to the gate drive, the other transistor takes over and
becomes more conducting. Thus the combined value of the two ON-resistances (as low
as 2 or 3Ω) stays more or less constant than would be the case for a single switching
transistor on its own.
When can demonstrate this in the following diagram.