Judy@4pcba.com
7:30 AM - 7:30 PM
Monday to Saturday

How to Do 74139 decoder

How to Do 74139 decoder

Introduction to the 74139 Decoder

The 74139 is a common TTL (Transistor-Transistor Logic) integrated circuit chip that can function as a decoder or demultiplexer. As a decoder, it takes a binary code as input and activates one of up to 8 output pins depending on the code. As a demultiplexer, it takes a single input and connects it to one of the output pins selected by the code.

Decoders like the 74139 are useful in digital logic circuits for tasks like memory addressing and multiplexing/demultiplexing signals. In this article, we’ll go through the pinout and functionality of the 74139 as a decoder, how to connect it to other logic chips, and some example circuits using it.

74139 Pinout

The 74139 dual 2-line to 4-line decoder chip comes in a 16-pin DIP (Dual In-line Package) with the following pinout:

The important pins are:

  • A0, A1 (Pins 1, 2): Binary address inputs
  • G1, G2A, G2B (Pins 6, 7, 9): Output enable inputs for two halves
  • Y0-Y3 (Pins 15-12): Decoded outputs for lower half
  • Y4-Y7 (Pins 11-8): Decoded outputs for upper half
  • Vcc (Pin 16): Power supply
  • Ground (Pin 8): Ground

The chip contains two separate decoders with shared address lines that can be enabled independently using the output enable pins. This allows using one 4-line decoder, or both together as an 8-line decoder.

74139 Internal Logic

The 74139 takes the 2-bit binary address on pins A0 and A1 and asserts one of the four outputs low based on the address:

A1A0Output
00Y0
01Y1
10Y2
11Y3

An output will be asserted low only if the corresponding output enable pin (G1 or G2A/B) is also low. If the enable input is high, all outputs will remain high regardless of the address.

Using both halves together as an 8-line decoder, the outputs are:

A1A0Output
00Y0
01Y1
10Y2
11Y3
00Y4
01Y5
10Y6
11Y7

Connecting the 74139 as a Decoder

Here is a typical way to connect a 74139 as a decoder:

  • Supply voltage Vcc to pin 16, ground to pin 8
  • Address inputs A0, A1 to input logic gates/pins
  • Output enables G1, G2 to logic 0 to enable both halves
  • Connect decoded outputs Y0-Y7 to other circuits
  • Add pull-up resistors from outputs to Vcc

The pull-up resistors ensure the outputs are high by default. The 74139 sinks current when asserting an output low, so external pull-ups are required.

Here is an example circuit:

This decodes a 2-bit address input to activate one of four outputs. The address lines A0 and A1 can come from logic gates, a microcontroller, or other sources. When an output is activated low, the corresponding LED will light up.

Example Circuits Using the 74139 Decoder

The 74139 has many applications in digital logic circuits. Here are some examples:

Memory Address Decoding

Decoders are commonly used to generate chip select and memory address signals from a binary address bus in memory systems:

The address bus provides the lower address bits, while the upper bits select which decoder output gets enabled. This maps different address ranges to the memory chips.

7-Segment Display Decoder

A 74139 can be used to decode a 4-bit BCD input to drive a 7-segment LED display:

The 4-bit BCD input lines activate one of 10 outputs to show digits 0 through 9 on the display.

Digital Logic Multiplexer

As a demultiplexer, the 74139 can route a single data input line to one of several output lines selected by the address:

Here the data on D can be connected by the decoder to any of the outputs Y0 to Y3 depending on the address. This effectively creates a 4-to-1 multiplexer.

Keyboard Encoder

A keyboard matrix encoder converts multiple switch inputs into a binary output code. The 74139 can be used with external logic gates to create such an encoder circuit:

Pressing a switch connects the corresponding row and column wires. The logic gates generate the corresponding 2-bit address that is output on A0 and A1.

As seen above, the 74139 decoder circuit can be very versatile and usable in many different logic circuit designs.

How to wire up and test a 74139 Decoder

Here is a step-by-step guide to connect and test a basic 74139 decoder circuit:

Supplies Needed

  • 74139 IC chip
  • 4004 IC chip (for address inputs)
  • LEDs (4x) and 220ohm resistors (4x)
  • Breadboard and jumper wires
  • 5V power supply

Circuit Diagram

Steps

  1. Insert the 74139 and 4004 ICs into the breadboard. Match the notch with the diagram.
  2. Connect pin 16 (Vcc) of 74139 to 5V power. Connect pin 8 (Gnd) to ground.
  3. Connect address pins 1 and 2 to outputs of 4004:
    • A0 (pin 1) to 4004 pin 2
    • A1 (pin 2) to 4004 pin 4
  4. Connect output enable pins 6 and 7 to ground.
  5. Connect LEDs and resistors from outputs (pins 11-15) to ground.
  6. Power up the circuit. The 4004 outputs will drive the address lines, cycling the LEDs on in sequence.
  7. Try changing the address line connections to reverse or re-order the sequence.
  8. To disable an output section, connect G1 or G2A/B to 5V instead of ground. The corresponding LEDs will stay off.

This circuit demonstrates how the 74139 decodes the input address and activates the correct output. You can modify it to explore different decoding logic.

Common Issues and Troubleshooting

Here are some common issues and troubleshooting tips for 74139 circuits:

  • All outputs stay high/LEDs off:
    • Check that Vcc and ground are connected properly
    • Ensure output enables (G1, G2A/B) are low
    • Check pull-up resistors on outputs
  • Multiple outputs active:
    • Address lines A0/A1 may be invalid logic levels
    • Noise/interference may be corrupting address lines
    • Enable pins not connected properly
  • Incorrect sequence:
    • Check wiring between address inputs & 74139 pins
    • Verify address line logic levels are correct
  • Short circuits:
    • Use ohmmeter to check for shorts between pins/traces
    • Ensure no loose wire strands causing shorts
  • Overheating:
    • Use heatsinks if driving high-current loads
    • Ensure proper supply voltage is applied

Carefully checking all connections and the address input logic can resolve most issues with 74139 decoder circuits.

Conclusion

The 74139 dual 2-line to 4-line decoder is a versatile TTL integrated circuit for address decoding, demultiplexing and other logic functions. With its separate output enables and shared address lines, it can be configured as a 4-to-16 line decoder. Example circuits include memory address decoding, 7-segment display driving, multiplexers, and encoders. With proper connections and pull-up resistors, the 74139 can provide reliable performance in digital logic systems.

Frequently Asked Questions

What is the difference between a decoder and demultiplexer?

For a decoder, the inputs are address lines and the selected output line is activated. For a demultiplexer, the single input contains data which gets connected to the selected output line. The internal circuits are the same, but they are used differently in digital logic systems.

How do I enable both halves of the 74139 decoder?

Connect the G1 and G2A/B pins to ground to enable both halves. G1 enables the lower 4 outputs Y0-Y3. G2A/B enables the upper 4 outputs Y4-Y7. Pulling either high will disable that section.

Can I connect the outputs directly to LEDs?

No, you should always use current limiting resistors between the 74139 outputs and any LEDs. The outputs are only meant to sink small amounts of current to drive logic inputs. Connecting LEDs directly could overdraw the outputs and damage the IC.

How many address lines can the 74139 decode?

The 74139 has 2 address line pins, so it can decode 2^2 = 4 address combinations. Using both halves, it can decode 2^3 = 8 addresses. For more addresses, cascaded decoders or a different IC would be needed.

Why do the outputs need pull-up resistors?

The 74139 sinks current to pull an output low. With no pull-up, the outputs would float high when not active. The pull-up resistors ensure the inactive outputs remain firmly high and do not float at intermediate logic levels.

Leave a Reply

Your email address will not be published. Required fields are marked *