Ugenz Academy/IoT Tutorial

Flip Flops

9 min read1,623 words

Reading progress

Keep learning

Flip-Flops in Digital Electronics

1. Introduction

A flip-flop is a basic sequential logic circuit that stores one bit of binary information, either 0 or 1. It is one of the most important building blocks of digital electronics because it allows digital systems to remember data and control the timing of operations.

Most flip-flops are controlled by a clock signal and change their stored state at a specific clock edge.

Flip-flops are used in computers, microcontrollers, digital clocks, counters, registers, and memory circuits.

2. Basic Working Principle of a Flip-Flop

A flip-flop typically has the following signals:

  • Data or control inputs: Determine the state to store or the operation to perform.
  • Clock (CLK): Controls when the flip-flop updates its state.
  • Output QQ: Represents the currently stored bit.
  • Complementary output Q‾\overline Q: Represents the opposite of the stored bit, when provided.

The stored state is often written as QQ, and the next state as Q_nextQ\_{\text{next}}.

For an edge-triggered flip-flop, the input is sampled at the active clock edge. Between active edges, the stored state normally remains unchanged, unless an asynchronous control such as reset or preset is activated.

Data and Control Inputs

Flip-Flop

Stores one binary bit

Q

Stored output

Q̅

Complement

The clock determines when the stored state updates.

3. Clock Signal in Flip-Flops

A clock is a digital signal that alternates between 0 and 1. It synchronizes the operation of digital circuits.

There are two common active clock edges.

A. Positive-edge triggering

A positive-edge-triggered flip-flop updates its state when the clock changes from 0 to 1.

This transition is called the rising edge.

B. Negative-edge triggering

A negative-edge-triggered flip-flop updates its state when the clock changes from 1 to 0.

This transition is called the falling edge.

Clock transitions

The chosen active edge depends on the flip-flop design.

4. SR Flip-Flop (Set-Reset Flip-Flop)

An SR flip-flop is a basic memory circuit with two control inputs:

  • S (Set): Sets the output QQ to 1.
  • R (Reset): Sets the output QQ to 0.

It updates its state at the active clock edge. When neither input is activated, it holds the previous state.

Truth table

SRNext state Q_nextQ\_{\text{next}}Operation
00Previous QQHold
010Reset
101Set
11InvalidForbidden state

Explanation

  • When S=0S=0 and R=0R=0, the flip-flop retains its stored bit.
  • When S=1S=1 and R=0R=0, the output becomes 1.
  • When S=0S=0 and R=1R=1, the output becomes 0.
  • When both inputs are 1, the conventional SR flip-flop enters a forbidden condition.

The forbidden condition arises because the set and reset commands conflict. The exact behavior depends on the circuit implementation.

Characteristic equation

For the valid input conditions:

Q_next=S+R‾QQ\_{\text{next}}=S+\overline RQ

This equation is used only when the forbidden input combination is excluded.

5. D Flip-Flop (Data Flip-Flop)

A D flip-flop is one of the most widely used flip-flops in digital electronics. The letter D stands for Data or Delay.

It has one main data input, DD, and stores the value present at that input when the active clock edge occurs.

Truth table

DNext state Q_nextQ\_{\text{next}}
00
11

The output changes to match the data input at the active clock edge.

Characteristic equation

Q_next=D\boxed{Q\_{\text{next}}=D}

Working principle

Suppose D=1D=1 when the active clock edge arrives. The flip-flop stores 1, and QQ becomes 1.

If DD later changes to 0 while no active clock edge occurs, QQ remains 1. At the next active clock edge, the flip-flop captures the new value 0.

This allows the circuit to store data independently of changes occurring between clock edges.

Applications

  • Data registers
  • Processor registers
  • Memory circuits
  • Pipeline stages
  • Synchronizing digital signals

6. JK Flip-Flop

A JK flip-flop is an improved form of the SR flip-flop. It has two inputs, JJ and KK, and avoids the conventional SR flip-flop's forbidden input condition.

Truth table

JKNext state Q_nextQ\_{\text{next}}Operation
00Previous QQHold
010Reset
101Set
11Q‾\overline QToggle

Explanation

  • J=0,K=0J=0, K=0: The previous state is retained.
  • J=0,K=1J=0, K=1: The output is reset to 0.
  • J=1,K=0J=1, K=0: The output is set to 1.
  • J=1,K=1J=1, K=1: The output toggles, meaning 0 becomes 1 and 1 becomes 0.

Characteristic equation

Q_next=JQ‾+K‾Q\boxed{Q\_{\text{next}}=J\overline Q+\overline KQ}

Applications

JK flip-flops are used in counters, frequency dividers, and control circuits. In a level-triggered implementation, the toggle condition can cause repeated switching while the clock is active; edge-triggered or master-slave designs help prevent this problem.

7. T Flip-Flop (Toggle Flip-Flop)

A T flip-flop is a sequential circuit that changes its stored state when its toggle input TT is 1.

It can be understood as a simplified JK flip-flop with both inputs connected together.

Truth table

TCurrent state QQNext state Q_nextQ\_{\text{next}}
000
011
101
110

Characteristic equation

Q_next=T⊕Q\boxed{Q\_{\text{next}}=T\oplus Q}

Working principle

  • When T=0T=0, the output does not change.
  • When T=1T=1, the output switches to its opposite value at each active clock edge.

For example, if the initial state is 0 and TT remains 1, successive active clock edges produce:

0→1→0→1→00\rightarrow1\rightarrow0\rightarrow1\rightarrow0

Applications

T flip-flops are used in binary counters, frequency dividers, and circuits that need to alternate between two states.

8. Comparison of the Four Main Flip-Flops

FeatureSRDJKT
InputsS, RDJ, KT
Main functionSet and resetStore dataSet, reset, toggleToggle
Hold operationYesDepends on input and clockYesYes
Toggle operationNot directlyNot directlyYesYes
Forbidden input combinationYes, in conventional SRNoNoNo
Common applicationBasic controlRegistersCounters and controlBinary counters

9. Master-Slave Flip-Flop

A master-slave flip-flop consists of two latch stages connected in series: a master and a slave.

The master accepts data during one clock phase, while the slave transfers the stored data to the output during the opposite phase.

Input Data

Master Latch

Slave Latch

Output Q

This arrangement can make the overall circuit behave like an edge-triggered storage element. Master-slave designs are especially associated with JK flip-flops and help prevent repeated toggling during a single active clock level.

10. Preset and Clear Inputs

Some flip-flops include additional control inputs called Preset and Clear.

  • Preset: Forces the output QQ to 1.
  • Clear: Forces the output QQ to 0.

These controls are often asynchronous, meaning they can change the stored state without waiting for a clock edge.

For example, a reset circuit can clear several flip-flops when a digital system starts, placing the system in a known initial state.

The active polarity of these inputs depends on the device. Some use active-HIGH controls, while others use active-LOW controls.

11. Timing Parameters of Flip-Flops

Flip-flops must meet timing requirements to store data reliably.

A. Setup time

The minimum time that the data input must remain stable before the active clock edge.

B. Hold time

The minimum time that the data input must remain stable after the active clock edge.

C. Clock-to-output propagation delay

The time between the active clock edge and the corresponding change at the output.

D. Maximum clock frequency

The highest clock frequency at which the flip-flop or complete sequential circuit can operate reliably under specified conditions.

If setup or hold requirements are violated, the circuit may experience metastability or incorrect data capture.

12. Applications of Flip-Flops

Flip-flops are essential components of digital systems.

  • Computers and processors: Store data, instructions, and intermediate results.
  • Registers: Hold multiple binary bits using groups of flip-flops.
  • Counters: Count clock pulses and generate binary sequences.
  • Digital clocks: Track time using counters and divider circuits.
  • Memory systems: Provide storage elements within digital architectures.
  • Communication systems: Support serial data handling and synchronization.
  • IoT and embedded systems: Store control states and coordinate timed operations.
  • Frequency dividers: Toggle outputs to produce lower-frequency signals.

13. Summary

A flip-flop is a sequential circuit that stores one bit of binary information and typically updates its state in response to a clock edge.

Flip-flopKey characteristic
SRSet, reset, and hold
DCaptures one data bit
JKSet, reset, hold, and toggle
TToggles or holds its state

Key point: Flip-flops provide the memory needed to build registers, counters, and other sequential circuits. Their clock-controlled behavior allows digital systems to store information and perform operations in a coordinated sequence.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy