Overview

The 74HC165 (SN74HC165A) is an 8-bit Parallel-In / Serial-Out (PISO) shift register IC manufactured by Texas Instruments, Nexperia, and ON Semiconductor. Containing eight internal D-type flip-flops, it captures eight parallel digital inputs simultaneously and shifts them out serially over a single data line.

Operating from 2.0V to 6.0V DC, the 74HC165 is the exact inverse of the 74HC595 shift register. While the 74HC595 expands microcontroller outputs (e.g. driving LEDs), the 74HC165 expands microcontroller inputs (reading push-buttons, DIP switches, or digital sensors) using just 3 micro-controller GPIO pins.

Quick reference

Supply Voltage (VCC)2.0 V to 6.0 V DC
Logic FamilyHigh-Speed CMOS (74HC) / TTL Compatible (74HCT)
Input Channels8 Parallel Input Pins (AHA \dots H or D0D7D_0 \dots D_7)
Serial OutputsComplementary outputs Q7Q_7 (Pin 9) and Q7\overline{Q_7} (Pin 7)
Propagation Delay15 ns15\text{ ns} typical at VCC=4.5VVCC = 4.5\text{V}
Cascade AbilityUnlimited daisy-chaining via SER serial input pin
Package16-pin DIP / SOIC-16 / TSSOP-16

Pinout (DIP-16 Package)

text
             ┌───┴───┐
       SH/LD 1│ 1   16│ VCC (+2V to +6V)
         CLK 2│       │15 CLK INH (GND)
           E 3│       │14 D
           F 4│ 74HC165│13 C
           G 5│       │12 B
           H 6│       │11 A
         /Q7 7│       │10 SER (Cascade In)
         GND 8│       │9  Q7 (Serial Data Out)
             └───────┘
PinNameDescription
1SH/LDShift / Parallel Load (Low = Latch 8 parallel inputs; High = Enable serial shift)
2CLKClock Input (Rising edge shifts data to Q7Q_7)
3EParallel Input Bit E (D4D_4)
4FParallel Input Bit F (D5D_5)
5GParallel Input Bit G (D6D_6)
6HParallel Input Bit H (D7D_7)
7\Q7Inverted Serial Data Output
8GNDGround reference (0 V)
9Q7Serial Data Output (Connect to MCU MISO / Data In)
10SERSerial Input for Daisy-Chaining (Connect to Q7Q_7 of preceding 74HC165)
11AParallel Input Bit A (D0D_0)
12BParallel Input Bit B (D1D_1)
13CParallel Input Bit C (D2D_2)
14DParallel Input Bit D (D3D_3)
15CLK INHClock Inhibit Input (Connect to GND to enable clocking)
16VCCPower supply voltage (+2.0V to +6.0V DC)

Function & Truth Table

SH/LDCLKCLK INHMode / Operation
Low (LL)XXParallel Load: Latches inputs AHA \dots H into internal registers
High (HH)\uparrowLow (LL)Shift: Shifts bits toward output Q7Q_7 on clock rising edge
High (HH)XHigh (HH)Inhibit: Holds clock state (no shift)

Example (Arduino Code - Reading 8 Buttons over SPI)

cpp
const int loadPin  = 8;  // SH/LD (Pin 1)
const int clockPin = 9;  // CLK (Pin 2)
const int dataPin  = 10; // Q7 (Pin 9)

void setup() {
  pinMode(loadPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, INPUT);
  Serial.begin(115200);
}

void loop() {
  // Latch parallel inputs (Pulse SH/LD LOW)
  digitalWrite(loadPin, LOW);
  delayMicroseconds(5);
  digitalWrite(loadPin, HIGH);

  // Read 8 bits serially
  byte incomingData = shiftIn(dataPin, clockPin, MSBFIRST);

  Serial.print("8-Button State: 0b");
  Serial.println(incomingData, BIN);
  delay(200);
}

Common mistakes

  • Leaving CLK INH (Pin 15) floating: Pin 15 is Clock Inhibit. If left ungrounded, static noise causes clock signals to be ignored. Tie CLK INH directly to GND.
  • Leaving unused parallel inputs (AHA \dots H) floating: Any unused parallel input pins must be tied to VCCV_{CC} or GND with pull-up/pull-down resistors to avoid unstable bit reads.

Notes

  • 74HC165 vs 74HC595: 74HC165 is Parallel-In Serial-Out (reads inputs); 74HC595 is Serial-In Parallel-Out (drives outputs).

Assets & downloads