The Binary Decoder |
Navigation |
|
|
Binary Decoder
A Decoder is the exact opposite to that of an "Encoder" we looked at in the last tutorial.
It is basically, a combinational type logic circuit that converts the binary code data at its input into
one of a number of different output lines, one at a time producing an equivalent decimal code at its output.
Binary Decoders have inputs of 2-bit, 3-bit or 4-bit codes depending upon the number of data input lines,
and a n-bit decoder has 2n output lines. Therefore, if it
receives n inputs (usually grouped as a binary or Boolean number) it activates one and only one of
its 2n outputs based on that input with all other outputs deactivated. A decoders output
code normally has more bits than its input code and practical binary decoder circuits include, 2-to-4, 3-to-8 and 4-to-16
line configurations.
A binary decoder converts coded inputs into coded outputs, where the input and output codes are different
and decoders are available to "decode" either a Binary or BCD (8421 code) input pattern to typically a Decimal output code.
Commonly available BCD-to-Decimal decoders include the TTL 7442 or the CMOS 4028. An example of a 2-to-4 line decoder along
with its truth table is given below. It consists of an array of four NAND gates, one of which is
selected for each combination of the input signals A and B.
A 2-to-4 Binary Decoders.
In this simple example of a 2-to-4 line binary decoder, the binary inputs A and
B determine which output line from D0 to D3
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 and these types of binary decoders are commonly used as Address Decoders in microprocessor
memory applications.
74LS138 Binary Decoder
Some binary decoders have an additional input labelled "Enable" that controls the outputs from the device.
This allows the decoders outputs to be turned "ON" or "OFF" and we can see that the logic diagram of the basic decoder is
identical to that of the basic demultiplexer. Therefore, we say that a demultiplexer is a decoder with an additional data
line that is used to enable the decoder. An alternative way of looking at the decoder circuit is to regard inputs
A, B and C as address signals. Each combination
of A, B or C defines a unique address which can
access a location having that address.
Sometimes it is required to have a Binary Decoder with a number of outputs greater than
is available, or if we only have small devices available, we can combine multiple decoders together to form larger decoder
networks as shown. Here a much larger 4-to-16 line binary decoder has been implemented using two smaller 3-to-8 decoders.
A 4-to-16 Binary Decoder Configuration.
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".
Memory Address Decoder.
Binary Decoders are most often used in more complex digital systems to access a
particular memory location based on an "address" produced by a computing device. In modern microprocessor systems the
amount of memory required can be quite high and is generally more than one single memory chip alone. One method of
overcoming this problem is to connect lots of individual memory chips together and to read the data on a common
"Data Bus". In order to prevent the data being "read" from each memory chip at the same time, each memory chip
is selected individually one at time and this process is known as Address Decoding.
In this application, the address represents the coded data input, and the outputs are the particular
memory element select signals. Each memory chip has an input called Chip Select or CS which is used by the
MPU to select the appropriate memory chip and a logic "1" on this input selects the device and a logic "0" on the input
de-selects it. By selecting or de-selecting each chip, allows us to select the correct memory device for a particular
address and when we specify a particular memory address, the corresponding memory location exists ONLY in one of the
chips.
For example, Lets assume we have a very simple microprocessor system with only 1Kb of RAM memory and
10 address lines. The memory consists of 128x8-bit (128x8 = 1024 bytes) devices and for 1Kb we will need 8 individual memory
devices but in order to select the correct memory chip we will also require a 3-to-8 line binary decoder as shown below.
Memory Address Decoding.
The binary decoder requires 3 address lines, (A0 to
A2) to select each one of the 8 chips (the lower part of the address), while the
remaining 7 address lines (A3 to A9) 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 the "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.
|