

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.








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 |
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) |
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
}
No Output Activation:
Multiple Outputs Active:
Incorrect Output Activation:
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.