Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use 74LS138: Examples, Pinouts, and Specs

Image of 74LS138Design with 74LS138 in Cirkit Designer

Introduction

The 74LS138 is a 3-to-8 line decoder/demultiplexer designed for use in digital circuits. It takes a 3-bit binary input and activates one of the eight outputs (Y0 to Y7) based on the input value. The remaining outputs remain inactive. This component is widely used in applications such as address decoding, memory selection, and data routing in microprocessor-based systems.

Explore Projects Built with 74LS138

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!

Common Applications:

Technical Specifications

The 74LS138 is a TTL (Transistor-Transistor Logic) device with the following key specifications:

Parameter Value
Supply Voltage (Vcc) 4.75V to 5.25V
Input Voltage (VIH, VIL) VIH: Min 2V, VIL: Max 0.8V
Output Voltage (VOH, VOL) VOH: Min 2.7V, VOL: Max 0.4V
Output Current (IOH, IOL) IOH: -0.4mA, IOL: 8mA
Propagation Delay 15ns (typical)
Power Dissipation 32mW (typical)
Operating Temperature 0°C to 70°C

Pin Configuration and Descriptions

The 74LS138 comes in a 16-pin DIP (Dual Inline Package). Below is the pinout and description:

Pin Number Pin Name Description
1 G1 Enable Input (Active HIGH)
2 G2A Enable Input (Active LOW)
3 G2B Enable Input (Active LOW)
4 A Input A (LSB of the 3-bit binary input)
5 B Input B (Middle bit of the 3-bit binary input)
6 C Input C (MSB of the 3-bit binary input)
7 Y7 Output 7 (Active LOW)
8 GND Ground
9 Y6 Output 6 (Active LOW)
10 Y5 Output 5 (Active LOW)
11 Y4 Output 4 (Active LOW)
12 Y3 Output 3 (Active LOW)
13 Y2 Output 2 (Active LOW)
14 Y1 Output 1 (Active LOW)
15 Y0 Output 0 (Active LOW)
16 Vcc Power Supply (5V)

Usage Instructions

How to Use the 74LS138 in a Circuit

  1. Power Supply: Connect the Vcc pin (Pin 16) to a 5V power supply and the GND pin (Pin 8) to ground.
  2. Enable Inputs: Ensure the enable inputs (G1, G2A, G2B) are correctly configured:
    • G1 must be HIGH (logic 1).
    • G2A and G2B must be LOW (logic 0).
  3. Binary Inputs: Provide a 3-bit binary input to pins A, B, and C. The combination of these inputs determines which output (Y0 to Y7) is activated.
  4. Outputs: The selected output will go LOW (active), while all other outputs remain HIGH.

Important Considerations:

Example: Connecting the 74LS138 to an Arduino UNO

The 74LS138 can be used with an Arduino UNO to decode binary inputs. Below is an example code snippet:

// Define input pins for the 74LS138
const int pinA = 2; // Connect to pin 4 (A) of 74LS138
const int pinB = 3; // Connect to pin 5 (B) of 74LS138
const int pinC = 4; // Connect to pin 6 (C) of 74LS138

// Define enable pins for the 74LS138
const int enableG1 = 5;  // Connect to pin 1 (G1)
const int enableG2A = 6; // Connect to pin 2 (G2A)
const int enableG2B = 7; // Connect to pin 3 (G2B)

void setup() {
  // Set input pins as outputs
  pinMode(pinA, OUTPUT);
  pinMode(pinB, OUTPUT);
  pinMode(pinC, OUTPUT);

  // Set enable pins as outputs
  pinMode(enableG1, OUTPUT);
  pinMode(enableG2A, OUTPUT);
  pinMode(enableG2B, OUTPUT);

  // Enable the 74LS138
  digitalWrite(enableG1, HIGH);  // G1 is active HIGH
  digitalWrite(enableG2A, LOW); // G2A is active LOW
  digitalWrite(enableG2B, LOW); // G2B is active LOW
}

void loop() {
  // Example: Activate output Y3 (binary input 011)
  digitalWrite(pinA, HIGH); // A = 1
  digitalWrite(pinB, HIGH); // B = 1
  digitalWrite(pinC, LOW);  // C = 0

  delay(1000); // Wait for 1 second

  // Example: Activate output Y5 (binary input 101)
  digitalWrite(pinA, HIGH); // A = 1
  digitalWrite(pinB, LOW);  // B = 0
  digitalWrite(pinC, HIGH); // C = 1

  delay(1000); // Wait for 1 second
}

Troubleshooting and FAQs

Common Issues:

  1. No Output Activation:

    • Ensure the enable inputs (G1, G2A, G2B) are correctly configured.
    • Verify that the power supply is within the specified range (4.75V to 5.25V).
    • Check for loose or incorrect connections.
  2. Multiple Outputs Active:

    • Verify that the binary inputs (A, B, C) are not floating.
    • Ensure there is no short circuit between output pins.
  3. Incorrect Output Activation:

    • Double-check the binary input values and their corresponding outputs.
    • Ensure the Arduino or other microcontroller is correctly driving the inputs.

FAQs:

Q1: Can the 74LS138 be used with a 3.3V microcontroller?
A1: The 74LS138 is designed for 5V operation. However, it can accept 3.3V logic levels as HIGH inputs in most cases. Verify compatibility with your specific microcontroller.

Q2: What happens if multiple enable inputs are active simultaneously?
A2: The 74LS138 requires G1 to be HIGH and both G2A and G2B to be LOW for proper operation. If these conditions are not met, all outputs will remain HIGH (inactive).

Q3: Can I cascade multiple 74LS138 ICs?
A3: Yes, you can cascade multiple 74LS138 ICs to decode more than 3 bits. Use the enable inputs to control which IC is active at a given time.