Saturday, February 28, 2015

decoder:What it Does,Input Devices,LED Driver,Schematic Symbol,Similar Devices,How It Works,Variants,Values,How to Use It,What Can Go Wrong,Glitches,Unhelpful Classification and Active-Low and Active-High.

decoder

In this Encyclopedia, a decoder is a digital chip that receives a binary-coded input and converts it to a decimal output by applying a logic state to one of a sequence of pins, each of which is assigned an integer value from 0 upward.

The term “decoder” also refers to components and devices that have other functions, such as decoding audio or video formats. These functions are not included here.

What it Does

A decoder receives a binary-coded number on two or more input pins. It decodes that number and expresses it by activating one of at least four output pins.

The behavior of a decoder with a two-bit binary input is shown in four sequential snapshots in Figure 15-1, where the least significant bit of the input is on the right in each diagram, and the output moves from right to left.

Figure 15-2 shows a similar sequence in a decoder where various values of a three-bit input are decoded to create an eight-pin output.

One sample state of a four-bit decoder is shown in Figure 15-3.

All of these figures assume that a high state rep- resents an active input or output. In a few chips, a low state is used to represent an active output.

Decoders with 2, 3, or 4 input pins are common. To handle a binary input greater than 1111 (decimal 15), decoders can be chained together, as described below.

Manufacturers’ datasheets often describe de- coders in terms of their inputs and outputs. Typ- ical examples would include:

• 2-to-4 decoder (two input pins, four output pins)

• 3-to-8 decoder (three input pins, eight out- put pins)

• 4-to-10 decoder (for converting binary- coded decimal to decimal output)

• 4-to-16 decoder (also known as a

hex decoder).

Input Devices

The input pins of a decoder can be driven by a counter that has a binary-coded output. A de- coder can also be driven by a microcontroller, which may have an insufficient number of out- put pins to control a variety of devices. Two, three, or four of the outputs can be used to rep- resent a binary number which is passed through the decoder to activate the devices one at a time, perhaps with transistors or Darlington arrays introduced to handle the load. This is suggested in Figure 15-4.

A shift register can be used for a similar purpose, but often has only one pin for input. This pin must be supplied sequentially with a serial pattern of bits that will match the desired high/low states of the output pins. The relative advantage of this system is that a shift register can generate any pattern of output states. A one- of-many decoder can activate only one output at a time.

LED Driver

A special case is a seven-segment decoder de- signed to drive a seven-segment LED display numeral. A binary-coded decimal number on four input pins is converted to a pattern of out- puts appropriate for lighting the segments of the display that will form a number from decimal 0 through 9.

Schematic Symbol

Like other logic-based components, the decoder does not have a specific schematic symbol and is represented by a plain rectangle as in Figure 15-5, with inputs on the left and outputs on the right. The bars printed above the E and LE abbreviations (which stand for Enable and Latch Enable, respectively) indicate that they are active-low. In this chip, the 74HC4514, all outputs are active-high, but in a related 4-to-16 decoder, the 74HC4515, all outputs are active-low. In both of these chips, the Enable pin is held low to activate the outputs. The Latch Enable pin freezes the current state of the outputs (i.e., it latches them) when it is held low.

Generally speaking, pins labeled A0, A1, A2… in a datasheet are often the binary inputs (although A, B, C… may be used), with A0 designating the least significant bit. Outputs are usually labeled Y, and are activated in sequence from Y0 when the binary input starts counting upward.

Similar Devices

The similarities and differences between encoder, decoder, multiplexer, and demultiplexer can cause confusion.

• In a decoder, a binary number is applied as a pattern of logic states on two or more input pins. This value determines which one of four or more output pins will have an active logic state, while the rest remain in an inactive logic state.

• A multiplexer can connect a choice of multiple inputs to a single output, for data transfer. The logic state of an enable pin, or a bi- nary number applied as a pattern of logic states to multiple control pins, chooses which input should be connected with the output pin. The alternative term data selector evokes the function of this device more clearly.

• An analog multiplexer may allow its inputs and outputs to be reversed, in which case it becomes a demultiplexer. It can connect a single input to one of multiple outputs, for data transfer. The logic state of an enable pin, or a binary number applied as a pattern of logic states to multiple control pins, chooses which output should be used. The alternative term data distributor evokes the function of this device more clearly.

clip_image005

Figure 15-1. A decoder with two input pins can interpret their binary-number representation to create an active logic state on one of four output pins.

clip_image007

Figure 15-2. A decoder with three input pins can interpret their binary-number representation to create a high logic state on one of eight output pins.

clip_image009

Figure 15-3. A decoder with four input pins can interpret their binary-number representation to create a high logic state on one of 16 output pins. Only one of the 16 possible states is shown here.

clip_image011

Figure 15-4. Four outputs from a binary counter or micro- controller can be used by a decoder to activate one of up to 16 output devices.

A photograph of a 74HC4514 decoder chip appears in Figure 15-6.

clip_image013

Figure 15-5. While no specific schematic symbol exists for a decoder chip, this style is commonly used. Shown here is a 4-to-16 decoder.

clip_image015

Figure 15-6. The 24-pin 74HC4514 decoder chip process- es a 4-bit input and represents it by making one of its 16 output pins active-high.

How It Works

A decoder contains logic gates, each of which is wired to respond to a unique binary pattern of inputs. (In the case of a seven-segment decoder, the internal logic is more complicated.) Figure 15-7 shows the logic of a 2-to-4 decoder. The darker blue area contains the components inside the chip. The external switches are included only to clarify the function of the decoder. An open switch is imagined to provide a low logic input, while each closed switch provides a high logic input.

Unlike ripple counters, where propagation de- lays can reduce the overall response time of the component, decoders function within two or three nanoseconds.

Variants

Decoder variants have not proliferated with time, and relatively few are available. Most are 3-to-8, 4-to-16, and binary-coded-decimal types.

The 7447 and 74LS47 are seven-segment decoders that have an open-collector output capable of driving a 7-segment display directly. The 7448 is similar but also contains built-in resistors and a capability to blank out leading zeros in a dis- play. However, some suppliers now list the 74LS48 as obsolete. It may be still available from old stock, but should not be specified in new circuits.

clip_image018

Figure 15-7. A simplified simulation of the logic in a de- coder. An actual chip would have an Enable line to activate the output. The dark blue rectangle indicates the space inside the chip.

Although 74LS47 is still being manufactured, and is available in surface-mount as well as through-hole format, a version is not available in the widely used HC family of 74xx chips. Care must be taken to satisfy the input voltage requirements of the 74LS47 when driving it with 74HCxx chips.

Values

As is the case with other logic chips, most de- coders in the through-hole 74xx series are in- tended for 5VDC power supply while the older 4000 series may tolerate up to 18VDC. Surface- mount versions may use voltages as low as 2VDC.

See the section on logic gates in Chapter 10 for a discussion of acceptable high and low input states. On the output side, the 4000 series chips are able to source or sink less than 1mA at 5VDC, but the 74HCxx series can manage around 20mA.

How to Use It

The original applications for decoders in computer circuits have become uncommon, but the chips can still be useful in small appliances and gadgets where multiple outputs are controlled by a counter or microcontroller.

Although 16 is usually the maximum number of outputs, some chips are designed to allow expansion. The 74x138 (where a chip family identifier such as LS or HC can be substituted for the letter x) is a 3-to-8 decoder with two logic-low Enable pins and one logic-high Enable. If a value-8 binary line is applied to the low-enable of one chip and the high-enable of another, the first chip will be disabled when the line goes high to indicate that the binary number 1000 has been reached, and the second chip can continue up- ward from there by sharing the same three less- significant-bit inputs. As many as four chips can be chained in this way.

What Can Go Wrong

Problems that are common to all digital chips are summarized in the section on logic gates in “What Can Go Wrong” on page 105.

Glitches

Although a decoder typically functions faster than a ripple counter, it suffers the same tendency to introduce brief glitches in its output. These are momentary invalid states which occur while processes inside the chip that are slightly slower are catching up with other processes that reach completion slightly faster. A brief settling time is necessary to ensure that the output is stable and valid. This will be irrelevant when powering a de- vice such as an LED indicator, which will not display such brief transients. The problem may be more important if the output from the de- coder is used as an input to other logic chips.

If the input to a decoder is derived from a ripple counter, the input may also contain glitches, which can cause erroneous outputs from the de- coder. It is better to use a synchronous counter on the input side of a decoder.

Unhelpful Classification

Online parts suppliers tend to list decoders un- der the same category heading as encoders, multiplexers, and demultiplexers, making it difficult to find what you want. Under this broad subject heading (which will include thousands of chips), if you search by selecting the number of inputs relative to the number of outputs that you have in mind, this will narrow the search considerably.

Active-Low and Active-High

Chips with identical appearance and similar part numbers may have outputs that are either active-low or active-high. Some may offer a latch-enable pin, while others have enable pins that must be pulled low or forced high to pro- duce an output. Accidental chip substitution is a common cause of confusion.