Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksToolsOpen the lab →

74HC165: the parallel-in, serial-out shift register, live

The 74HC165 is an 8-bit parallel-load shift register: while SH/LD is low it copies eight inputs A to H into its stages, and once SH/LD is high each rising clock edge shifts the bits one place toward the serial output QH, with SER filling in behind. It is how a microcontroller reads eight buttons or switches through three pins.

TI's datasheet describes eight individual direct data inputs, A to H, "enabled by a low level at the shift/load (SH/LD) input", so the load does not wait for a clock: while SH/LD is low, each stage simply follows its input. This live circuit builds that with master-slave flip-flops that have their own asynchronous preset and clear: during a load, each stage is preset when its input is 1 and cleared when it is 0. (The six-NAND flip-flop of the 7474 page relies on gate delays to shift safely in a chain, so this zero-delay simulation uses the master-slave form for the stages.) When SH/LD goes high the stages form an ordinary shift register: SER into A, A into B, and so on, with H on QH and its complement on QH'. The clock is CLK OR CLK INH, which is why the datasheet says their functions are interchangeable: hold CLK INH high to ignore CLK, or hold CLK low and clock with CLK INH. QH shows H right after the load, so reading all eight bits takes one load and seven clocks. Chain chips by wiring QH of one to SER of the next. The live circuit opens loading (SH/LD = 0) with A to H at 0: set some inputs, then set SH/LD to 1 and clock CLK. Before the page is built, a 27-step sequence (load 10110010, shift on CLK, CLK INH raised while CLK is high and a blocked clock, shifts clocked by CLK INH, and a second load) is checked on QH and QH'.

Big circuit: pinch, scroll or tap + to zoom in, then drag to move around.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

What you need

Step by step

  1. Place inputs SH/LD, CLK, CLK INH, SER and A to H, and probes QH and QHbar.
  2. Chain eight D flip-flops with preset and clear: SER into stage A's D, each Q into the next stage's D, with H's Q and Q' on QH and QHbar.
  3. Clock all stages from CLK OR CLK INH.
  4. For the parallel load, let load = NOT SH/LD drive each stage's preset through load AND x and its clear through load AND NOT x.
  5. Load 10110010 (A to H), set SH/LD = 1, then pulse CLK: QH shows H, then G, F, and so on, one bit per rising edge.

74HC165 function table

SH/LDCLKCLK INHWhat happens
0XXParallel load: the stages take A to H
11XNo change
1X1No change
10risingShift toward QH, SER into the first stage
1rising0Shift toward QH, SER into the first stage

74HC165 pinout

PinNamePinName
1SH/LD16VCC
2CLK15CLK INH
3E14D
4F13C
5G12B
6H11A
7QH' (complement)10SER
8GND9QH

X means the input does not matter. The function table and the 16-pin pinout are from TI's SN74HC165 datasheet (SCLS116H), checked 2026-10-25; it runs from 2 V to 6 V, and the datasheet adds that CLK INH should only be raised while CLK is high. The serial-in, parallel-out partner chip is the 74HC595; the 4-bit version of this circuit is the PISO shift register.

You can also read the full theory in the lesson on shift registers. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

Build more parts from gates

half adderfull adderhalf subtractorfull subtractor2:1 multiplexer4:1 multiplexerXOR gate from NAND gates2-to-4 decoderSR latchD flip-flopJK flip-flopT flip-flop4-bit shift register4-bit ripple carry adderD latch1-to-4 demultiplexer4-bit magnitude comparator4-bit ring counter4-bit Johnson counter4-to-2 priority encoder4-bit synchronous counter3-to-8 decoder8-to-1 multiplexer4-bit carry lookahead adderhalf adder from NAND gates2-bit comparatorBCD to 7-segment decoder4-bit up/down counterdecade counter2-bit multiplier4-bit ALU4-bit array multiplierNOT, AND, OR and NOR from NANDNOT, OR, AND and XOR from NORfull adder from NAND gatesSR latch from NAND gatesparity generator and checker4-bit adder/subtractorBCD adder4-bit universal shift registermod-6 counter4-bit ripple counterbinary to Gray code converterhalf adder from NOR gatesfull adder from NOR gates4-bit register with parallel load1011 sequence detectorbinary to BCD converterD flip-flop from NAND gates1-bit ALUCMOS inverterCMOS NAND gateCMOS NOR gatePISO shift registerSR flip-flop from NAND gatesBCD to excess-3 code converterHamming (7,4) code encoder and correctortraffic light controller4-bit barrel shifterCMOS AND gateCMOS OR gateCMOS XOR gate1-bit magnitude comparatorhalf subtractor from NAND gatesfull subtractor from NAND gates8-to-3 encoderGray to binary converter4-to-16 decoderfull adder using 4:1 multiplexersedge detectorserial adder4-bit carry-select adder4-bit Kogge-Stone adder4-bit carry-skip adder4x4 Wallace tree multiplier8-bit adderfrequency divider (by 2, 4 and 3)switch debouncer (SR latch)3-bit Gray code counterMealy machine (1011 detector)master-slave JK flip-flop (NAND)half subtractor from NOR gates1-to-8 demultiplexerexcess-3 to BCD code convertervending machine FSM4-bit carry-save adder3-bit synchronous counter (JK)CMOS transmission gatetri-state buffer (CMOS)2-to-1 mux from transmission gatesmod-5 counterflip-flop conversion (JK to D)8-bit ALUdecimal to BCD encoderBCD to decimal decoder4-to-1 mux from 2-to-1 muxesXOR gate from NOR gates4-bit LFSR74LS138 decoderBCD subtractor74181 ALUCMOS AOI gate (AOI21)D latch vs D flip-flop74LS47 BCD to 7-segment decoder74HC595 shift register7400 quad NAND gate chip7402 quad NOR gate chip7404 hex inverter chip7408 quad AND gate chip7432 quad OR gate chip7486 quad XOR gate chip7474 dual D flip-flopCD4017 decade counter74LS283 4-bit adder74LS90 decade counter74HC161 4-bit counter

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the 74HC165 shift register in the lab →

Frequently asked

How does the 74HC165 work?

Pull SH/LD low to copy the eight parallel inputs A to H into the register, then set it high and clock CLK: each rising edge shifts the bits one place toward QH, so the bits come out one at a time, H first, while SER shifts in behind them.

What is the difference between the 74HC165 and the 74HC595?

They are opposites. The 74HC165 is parallel-in, serial-out: it reads eight inputs into one data line. The 74HC595 is serial-in, parallel-out: it takes bits from one data line and drives eight outputs.

What is CLK INH on the 74HC165?

Clock inhibit. The internal clock is CLK OR CLK INH, so while CLK INH is high the register ignores CLK. Because the two are interchangeable, you can also hold CLK low and use a rising edge on CLK INH as the clock.

How do you read more than 8 inputs with 74HC165s?

Chain them: connect QH of the first chip to SER of the next and share SH/LD and CLK. Load all of them at once, then clock out 8 bits per chip.