Home
LogicRoo / Sequential Circuits / JK Flip-Flop Circuit
SEQUENTIAL · FLIP-FLOP

JK Flip-Flop Circuit

A JK flip-flop walkthrough — truth table, toggle behaviour, the race-around condition, wiring steps, and an interactive flip-flop you can explore in the browser.

Sequential logic · 1 memory IC

Set it, reset it, hold it,
or toggle it.

A JK flip-flop is a D flip-flop with no invalid state. On each falling clock edge, J=1 sets Q, K=1 resets it, both low holds it, and both high flips it. That last case is what makes it the natural cell for counters.

2Data inputs J, K
4Modes: hold, set, reset, toggle
↓Triggers on falling edge
74HC112Memory IC
Set J and K, then pulse CLK, or flip the view to see the timing diagram →
SCH-04 · 74HC112_JKFF
mode hold
⇄ Show timing diagram
Q
Q̄
J0 K0 Q0 Q̄1
Falling edges0 Q0
J0
K0
CLK · pulse ↓
PRE · set Q
CLR · reset Q

Toggle J and K, then press CLK to act on them · hold PRE or CLR to force Q · flip the view above to see the waveforms


Parts bin

What you need

One IC holds the bit. The rest is a way to feed it J, K and a clock, and a place to see the result.

×1 74HC112 — dual JK flip-flop IC (one half used) IC1
×2 Slide switch (SPDT) — J and K inputs SW-J, SW-K
×1 Pushbutton — clock SW-CLK
×2 LED — Q and Q̄ indicators LED1–2
×2 330 Ω Resistor — LED current limit R1–R2
×1 10 kΩ Resistor — CLK pull-down R3
×1 100 nF Capacitor — supply decoupling C1
×1 Breadboard BASE
×— Jumper Wires BASE
×1 5V Supply (2–6V accepted) PWR

Reference

74HC112 pin overview (flip-flop 1)

The chip has two identical flip-flops. These are the pins of the first one.

PinNumberTypeWhat it does
VCC 16 Power Supply voltage, +2V to +6V
GND 8 Power Ground, 0V
1J 3 Input J input: sets Q to 1 on the clock edge
1K 2 Input K input: resets Q to 0 on the clock edge
1CLK 1 Input Clock, triggers on the HIGH → LOW edge
1PRE 4 Input Preset, active LOW: forces Q = 1 at once
1CLR 15 Input Clear, active LOW: forces Q = 0 at once
1Q 5 Output The stored bit
1Q̄ 6 Output Always the opposite of Q

Behaviour

Truth table

Values apply on each falling clock edge, with PRE and CLR inactive. The characteristic equation is Q(next) = J·Q̄ + K̄·Q.

J KQ(next)Q̄(next)Action
0 0 Q Q̄ Hold
0 1 0 1 Reset
1 0 1 0 Set
1 1 Q̄ Q Toggle

Operating principle

How a JK flip-flop decides

Flip to the timing view above, set J=K=1 and pulse the clock a few times to watch Q divide the clock by two.

01

Choose J and K: hold, set, reset or toggle.

02

Nothing happens to Q while the clock is steady.

03

On the clock's falling edge, the flip-flop reads J and K.

04

Q updates once and holds until the next falling edge.

A JK flip-flop fixes the weak spot of the plain SR latch. In an SR latch, S=R=1 is forbidden. Here, J=K=1 is given a useful meaning: toggle. Internally the outputs are fed back to the inputs, so J only has an effect while Q is 0 and K only while Q is 1.

Tie J and K both HIGH and every falling clock edge flips Q, so Q runs at half the clock frequency. Chain stages and you have a binary ripple counter, which is why JK cells are the classic counting building block.

Because it is edge-triggered and not level-triggered, the toggle happens exactly once per clock. It cannot oscillate for as long as the clock stays high. The usual rule still applies: keep J and K steady for a tiny moment before the edge (setup time) and just after it (hold time).

Two control pins worth knowing

PRE (Preset): pull it LOW and Q is forced to 1 immediately, without waiting for the clock.

CLR (Clear): pull it LOW and Q is forced to 0 immediately. Handy for starting from a known state at power-up.

Both are asynchronous and active LOW. Holding both LOW at once is invalid, and the chip drives Q and Q̄ HIGH together.


Assembly

Building it on a breadboard

Six steps. The same footprint becomes one stage of a counter or shift register later.

Seat the 74HC112

Straddle the chip across the centre gap, notch to the left, so pins 1–8 and 9–16 land in separate rows.

Power it and park the unused half

VCC (16) to the positive rail, GND (8) to the negative rail, with the 100 nF capacitor right beside the chip. Only one of the two flip-flops is used: tie the other half's PRE and CLR (10 and 14) to VCC, and its J, K and CLK (11, 12 and 13) to GND. Floating CMOS inputs pick up noise and waste power.

Disable preset and clear

PRE (4) and CLR (15) are active LOW, so tie both straight to VCC for normal operation. Left floating, they can force the flip-flop at random.

Wire J, K and the clock

Each slide switch connects its input to +V or GND: one on J (3), one on K (2). The clock pushbutton goes from +V to CLK (1), with a 10 kΩ resistor from CLK to GND so the pin reads a clean LOW until you press. The chip triggers on the falling edge, so the output updates when you release the button.

Add the output LEDs

Q (5) and Q̄ (6) each drive an LED through its own 330 Ω resistor to GND. Exactly one LED should be lit at any time.

Power up and test it

Set J and K with the switches, then press and release the clock button. Q updates at the moment of release. Try all four combinations: J=K=0 holds, J=0 K=1 resets, J=1 K=0 sets, and J=K=1 flips Q on every clock.


If it misbehaves

Jumpy, stuck, or both LEDs lit

Almost always a bouncing clock button, a floating PRE/CLR pin, or forgetting that the edge is the falling one.

  • Q changes on release, not on press — that is correct. The 74HC112 triggers on the falling edge, so the change happens when CLK goes from HIGH back to LOW.
  • Q toggles several times per click — the pushbutton is bouncing and sending a burst of clock edges; feed the clock from a debounced source, such as an SR-latch debouncer.
  • Q is stuck at 0 or 1 and ignores the clock — PRE or CLR is floating or LOW; tie both to VCC.
  • Both LEDs are lit — PRE and CLR are LOW at the same time, which is an invalid combination for this chip.
  • Nothing ever changes — the clock wire is on pin 13 (the second flip-flop) instead of pin 1, or J and K are both 0, which holds the state.
  • The first state after power-up is random — that is normal. A flip-flop has no defined start state, so pulse CLR once to start from a known 0.