SN74S74N: the D flip-flop explained step by step

A D flip-flop is a one-bit memory that only listens at one precise moment: the rising edge of its clock. The Texas Instruments SN74S74N contains two of them in a 14-pin DIP, built in fast Schottky TTL (74S). This guide explains what “edge-triggered” means, what the PRE and CLR pins do, which timing rules you must respect, and how one flip-flop divides a clock by two.

What a D flip-flop does

Think of the D input as a question (“what should I store?”) and the clock as a camera shutter. While the clock is steady, D may change as much as it likes and the output Q ignores it. At the instant the clock goes from LOW to HIGH – the rising edge – the flip-flop takes a snapshot of D and copies it to Q. Q then holds that value until the next rising edge.

Every flip-flop also has an inverted output Q, which is always the opposite of Q in normal operation. Two extra inputs override the clock: PRE (preset) forces Q HIGH and CLR (clear) forces Q LOW. The bar over the names means they are active low: they do something when you pull them to 0 V and nothing when they sit HIGH.

This is different from a transparent latch such as the 74HC373, whose output follows the input during the whole enable time. A flip-flop reacts only to the edge, which is why it is the building block of counters, shift registers and synchronous logic.

Pins and the function table

The SN74S74N is the PDIP (N) version, rated 0–70 °C. Both flip-flops share VCC (pin 14) and GND (pin 7):

  • Flip-flop 1: CLR pin 1, D pin 2, CLK pin 3, PRE pin 4, Q pin 5, Q pin 6.
  • Flip-flop 2: Q pin 8, Q pin 9, PRE pin 10, CLK pin 11, D pin 12, CLR pin 13.
  • Function table: PRE=L, CLR=H → Q=H. PRE=H, CLR=L → Q=L. Both H and a rising CLK edge → Q takes the value of D. Both H and CLK steady → Q holds.
  • PRE and CLR both LOW forces Q and Q HIGH together. TI marks this state as non-stable: it does not persist when the inputs return HIGH, so avoid it.
Top-view pinout of the SN74S74N in a 14-pin DIP: pins 1 to 7 on the left are 1CLR, 1D, 1CLK, 1PRE, 1Q, 1Q-bar and GND; pins 14 to 8 on the right are VCC, 2CLR, 2D, 2CLK, 2PRE, 2Q and 2Q-bar.
SN74S74N seen from above. The notch and dot mark the pin-1 end; bars mark active-low pins and the inverted output.

One transfer, nanosecond by nanosecond

Edge triggering has rules. D must be stable for a short time before the edge (setup time) and stay stable a short time after it (hold time). For the SN74S74 TI specifies a minimum setup time of 3 ns and a minimum hold time of 2 ns. Break these rules and Q may take the wrong value.

After a valid edge, Q changes after the propagation delay: typically 6 ns and at most 9 ns from CLK to Q or Q (VCC = 5 V, 25 °C). The clock may run at up to 75 MHz guaranteed (110 MHz typical), with a HIGH pulse of at least 6 ns and a LOW pulse of at least 7.3 ns.

CLR does not wait for the clock. Pull it LOW for at least 7 ns and Q goes LOW within at most 13.5 ns (CLK high) or 8 ns (CLK low), whatever D and CLK do.

Timing diagram with CLK, D, Q and CLR traces. D goes high before the first rising CLK edge, meeting a setup time of at least 3 ns and a hold time of at least 2 ns; Q goes high at most 9 ns after the edge. D then drops briefly between edges; Q ignores it and is still high after the second edge. Finally CLR goes low and forces Q low without a clock edge.
One transfer: D is sampled only at the rising edge, Q follows after the propagation delay, and CLR overrides the clock.

Example: divide a clock by 2

The classic first circuit is the toggle, or divide-by-2. Connect Q back to D. If Q is LOW, Q is HIGH, so the next rising edge stores HIGH; then Q becomes LOW and the following edge stores LOW. Q therefore changes state on every rising edge, and its frequency is exactly half the clock frequency with a 50 % duty cycle.

The example uses flip-flop 2: Q on pin 8 goes to D on pin 12, the clock enters CLK on pin 11, and the output is taken from pin 8 (or pin 9). PRE and CLR are pulled HIGH so the clock is in control.

An LED with a 330 Ω resistor from +5 V to Q (pin 9) shows the state. TTL outputs are strong when pulling LOW: the SN74S74 is specified for 20 mA at no more than 0.5 V, but only 1 mA when HIGH. Letting the output sink the current is therefore correct; with a red LED the current is about 8 mA. With a 1 Hz clock the LED blinks with a two-second period.

Example schematic: half of an SN74S74N with 2Q-bar (pin 8) fed back to 2D (pin 12), a clean 5 V clock into 2CLK (pin 11), an f/2 output, and an LED with 330 ohm from +5 V to 2Q (pin 9). 2PRE and 2CLR are pulled to +5 V through 1 kilohm.
Teaching example: feedback from 2Q̄ to 2D makes the flip-flop toggle on every rising edge, dividing the clock by two.

Building it step by step

  1. Fit the SN74S74N on a breadboard across the centre channel with the notch to the left. Connect pin 14 to +5 V and pin 7 to GND, and place a 100 nF ceramic capacitor directly between pins 14 and 7.
  2. Tie the unused flip-flop 1 to safe levels: D (pin 2) and CLK (pin 3) to GND, PRE (pin 4) and CLR (pin 1) to +5 V through 1 kΩ. Leave its outputs open.
  3. Pull 2PRE (pin 10) and 2CLR (pin 13) to +5 V through 1 kΩ. Briefly grounding pin 13 later is a handy manual reset.
  4. Wire pin 8 to pin 12. Connect the LED: +5 V → 330 Ω → LED anode, LED cathode → pin 9.
  5. Feed a clean 5 V logic clock into pin 11, for example the output of a 555 timer or an oscillator. Do not use a bare push button: contact bounce produces many edges and the flip-flop counts every one of them.
  6. Measure pins 11 and 9 with two oscilloscope channels or a logic probe. Pin 9 should change only on rising edges of pin 11 and run at half the frequency.

Limits and pitfalls

  • Supply: 4.75–5.25 V for the SN74S74; input voltage must not exceed 5.5 V. This is not a 3.3 V part.
  • Input levels: HIGH ≥ 2.0 V, LOW ≤ 0.8 V. A LOW input must be able to deliver current: up to 2 mA from D, 4 mA from CLK or PRE and 6 mA from CLR. Check that whatever drives these inputs can sink that current; weak CMOS outputs may not.
  • Output HIGH is only guaranteed to 2.7 V at −1 mA. When driving 5 V CMOS with CMOS input thresholds, use an HCT gate or a pull-up resistor.
  • Current consumption is high by modern standards: TI gives 15 mA typical and 25 mA maximum per flip-flop.
  • S-TTL edges are fast. Keep wires short, use the 100 nF decoupling capacitor, and expect ringing on long breadboard leads.
  • The device on sale is new old stock from 1980 production (date code 8045). It is unused but not tested by us; the datasheet is the family reference, not a test report.

Related guides

Standard TTL voltage levels and why outputs should sink current are explained in the SN7404N hex inverter guide. For the difference between a flip-flop and a latch, compare with the SN74HC373N transparent latch guide. Multi-bit registers are shown in the MC74HC173 register guide, and the J-K variant in the MC14027B J-K flip-flop guide. For a clean clock source see the LMC555 timer guide, and for cleaning up slow or bouncy signals the MC14093B Schmitt-trigger guide.

Sources

Pinout, package, function table, operating conditions, DC values and switching times: Texas Instruments, SN5474, SN54LS74A, SN54S74, SN7474, SN74LS74A, SN74S74 Dual D-Type Positive-Edge-Triggered Flip-Flops With Preset and Clear, SDLS119 (December 1983, revised March 1988), including its package option addendum. The example is a teaching circuit, not a tested product design.

See the SN74S74N product · Texas Instruments SN74S74 datasheet (PDF)