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

74HC161 (74LS161): the synchronous 4-bit counter, live

The 74HC161 is a synchronous 4-bit binary counter: on each rising edge of CLK it adds 1 to QD QC QB QA while ENP and ENT are both high, loads the inputs D C B A instead when LOAD is low, and clears to 0000 at once when CLR goes low. RCO (ripple carry out) is high at 15 so counters can be chained. This live circuit behaves like the chip.

TI's datasheet calls it a synchronous, presettable counter with internal carry look-ahead: all four flip-flops are clocked together, which "eliminates the output counting spikes" of ripple counters (compare the ripple counter). Bit i flips on a clock edge when ENP, ENT and all the bits below it are 1, the same rule as the synchronous counter; this version gets each D input from an XOR of the bit with that condition, then a 2-to-1 choice between the count and the load data. The datasheet is careful about which controls wait for the clock: LOAD is synchronous ("the outputs agree with the setup data after the next clock pulse"), but CLR is asynchronous ("a low level at the clear (CLR) input sets all four of the flip-flop outputs low, regardless of the levels of the CLK, load (LOAD), or enable inputs"). ENT also gates RCO, so a chain of counters is built by feeding each RCO into the next counter's ENT. Here CLK is a plain switch. The live circuit opens held clear (CLR = 0) with ENP, ENT and LOAD high: set CLR to 1 and pulse CLK to count. Before the page is built, a 61-step sequence (17 counts through 15 and back to 0, holds with ENP and with ENT low, a synchronous load of 1010, more counts and an asynchronous clear) is checked on all five outputs.

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 CLR, CLK, A to D, ENP, ENT and LOAD, and probes QA to QD and RCO.
  2. Put four D flip-flops with clear on one CLK, cleared by NOT CLR, so the clear does not wait for the clock.
  3. Compute the next count: bit i toggles when ENP AND ENT AND all lower bits are 1, so its next value is Qi XOR that condition.
  4. Before each D input, choose the next count when LOAD = 1 or the input A to D when LOAD = 0.
  5. Add RCO = ENT QA QB QC QD. Set CLR to 1 and pulse CLK: the count runs 0 to 15, RCO lights at 15, and the next pulse wraps to 0.

74HC161 function summary

CLRLOADENPENTCLKWhat happens
0XXXXClear to 0000 at once (asynchronous)
10XXrisingLoad D C B A (synchronous)
1111risingCount up by 1
110XrisingHold
11X0risingHold, and RCO is 0

74HC161 pinout

PinNamePinName
1CLR (active low)16VCC
2CLK15RCO
3A14QA
4B13QB
5C12QC
6D11QD
7ENP10ENT
8GND9LOAD (active low)

X means the input does not matter. QA is the least significant bit. The behavior and the 16-pin pinout are from TI's SN74HC161 datasheet (SCLS297D), checked 2026-10-25; it runs from 2 V to 6 V. The datasheet also notes that changes on ENP, ENT or LOAD do nothing until the next clock edge.

You can also read the full theory in the lesson on synchronous counters. 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-flop74HC165 shift registerCD4017 decade counter74LS283 4-bit adder74LS90 decade 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 74HC161 4-bit counter in the lab →

Frequently asked

What does the 74HC161 do?

It is a 4-bit synchronous binary counter. On each rising clock edge it counts up when ENP and ENT are high, loads a new value from inputs A to D when LOAD is low, and it can be cleared to zero at any time by taking CLR low.

Is the 74HC161 clear synchronous or asynchronous?

Asynchronous: a low level on CLR sets all four outputs low immediately, regardless of the clock, LOAD or the enable inputs. Its load, by contrast, is synchronous and waits for the next clock edge.

What is the difference between ENP and ENT?

Both must be high to count. ENT also enables the ripple carry output RCO, so when chaining counters you feed each RCO into the next counter's ENT and use ENP as a common enable.

How do you make a mod-10 counter with a 74HC161?

Load 0000 when the count reaches 9: with A to D at 0, drive LOAD low whenever QD and QA are both 1 (a NAND gate of QD and QA does it, since 1001 is the first count with both set), so the next clock edge loads 0 instead of counting to 10. Because the load is synchronous, the count shows 9 for a full clock period.

What is the difference between the 74LS161 and the 74HC161?

The same counter and pinout in different technologies: the 74LS161 is TTL for 5 V, the 74HC161 is CMOS for 2 V to 6 V with lower power.