← All parts

74HC165 Shift Register (PISO)

SN74HC165

Texas Instrumentsic logic timer

The SNx4HC165 is an 8-bit parallel-load shift register that converts parallel data to serial data. It features eight parallel inputs, a serial input, and complementary serial outputs, with control for shifting or loading data.

In stock

Specifications

10
Operating Voltage
2 to 6 V
Number Of Bits
8
Interface
parallel-to-serial
Supply Current Max
80 µA
Output Drive Current
±4 mA
Propagation Delay Typical
13 ns
Input Current Max
1 µA
Clock Frequency Max
36 MHz
Operating Temperature Range
-40 to 125 °C
Package Type
SOIC, SSOP, PDIP, SO, TSSOP

Pinout

16
PinNameFunctionsNotes
1SH/LD
GPIO
Shift or Load input; low for parallel load, high for shifting
2CLK
GPIO
Clock input for shifting data
3E
GPIO
Parallel data input E
4F
GPIO
Parallel data input F
5G
GPIO
Parallel data input G
6H
GPIO
Parallel data input H
7QH
GPIO
Complementary serial data output
8GND
GND
Ground connection
9Q
GPIO
Serial data output
10SER
GPIO
Serial data input
11A
GPIO
Parallel data input A
12B
GPIO
Parallel data input B
13C
GPIO
Parallel data input C
14D
GPIO
Parallel data input D
15CLK INH
GPIO
Clock Inhibit input; high prevents output changes
16VCC
POWER
Positive supply voltage

Interactive pinout

Highlight:
SN74HC165

Click a pin to copy its name · tap a tag above to spotlight a bus.

Starter code

Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.

Arduino (C++)

arduino
// 74HC165 parallel-in / serial-out shift register — community starter example
// Reads 8 inputs with shiftIn(); chain QH -> next SER for more.
#if defined(ESP32)
  #define LOAD_PIN  5    // SH/LD
  #define CLK_PIN   18   // CLK
  #define DATA_PIN  19   // QH (serial out)
#else
  #define LOAD_PIN  8
  #define CLK_PIN   7
  #define DATA_PIN  9
#endif

byte readInputs() {
  digitalWrite(LOAD_PIN, LOW);              // load parallel inputs
  digitalWrite(LOAD_PIN, HIGH);
  return shiftIn(DATA_PIN, CLK_PIN, MSBFIRST);
}

void setup() {
  Serial.begin(115200);
  pinMode(LOAD_PIN, OUTPUT);
  pinMode(CLK_PIN, OUTPUT);
  pinMode(DATA_PIN, INPUT);
}

void loop() {
  Serial.println(readInputs(), BIN);
  delay(300);
}

MicroPython

python
# 74HC165 parallel-in shift register (ESP32) — community starter example
from machine import Pin
import time

load = Pin(5, Pin.OUT)    # SH/LD
clk  = Pin(18, Pin.OUT)
data = Pin(19, Pin.IN)    # QH

def read_inputs():
    load.value(0); load.value(1)            # latch the 8 inputs
    v = 0
    for _ in range(8):
        v = (v << 1) | data.value()
        clk.value(1); clk.value(0)
    return v

while True:
    print(bin(read_inputs()))
    time.sleep(0.3)

Wiring

PinArduino Uno R3ESP32 DevKitC (WROOM-32)Notes
VCC+5V3V32-6 V
GNDGNDGND
SH/LDD8GPIO5Latch: LOW loads inputs
CLKD7GPIO18Shift clock
QHD9GPIO19Serial data out to the board
CLK INHGNDGNDTie LOW to enable clocking
A..H--8 parallel inputs (buttons/switches)

Typical uses

  • Reading many buttons/switches from 3 pins
  • Expanding inputs (chain for 16, 24, ...)

Related parts

6