Home

 › 

Articles

 › 

What Is a Flip-Flop in Electronics? Full Explanation with Examples

flip-flop in electronics

What Is a Flip-Flop in Electronics? Full Explanation with Examples

If you’re new to the world of digital electronics, the term “flip-flop” may sound like a type of summer footwear. However, in electronics, it means something entirely different. Flip-flops are essential components that allow electronic devices to store and manipulate binary data. 

They are electronic circuits that store a single bit of binary data and are commonly used in digital circuits for memory storage, counters, and synchronization circuits. They are also widely used in microprocessors for data storage and processing.

In this article, we’ll provide you with a comprehensive explanation of what a flip-flop in electronics is, how it works, and the different types available. Whether you’re a novice or an enthusiast looking for a helpful refresher, we’ll walk you through the ins and outs of flip-flops.

What Exactly Is a Flip-Flop in Electronics?

First things first, what’s a flip-flop? In electronics, a flip-flop is a circuit that can store a single bit of binary data (0 or 1) using electronic switches. It has two stable states: SET and RESET. The ‘set’ state is when the output of the circuit is 1, and the ‘reset’ state is when the output is 0.

A flip-flop can be triggered to change its state by applying a pulse or signal to its input. When the input signal is applied, the output of the flip-flop will change to the opposite state. For example, if the flip-flop is in the ‘set’ state, applying a signal to its input will change its state to ‘reset.’

Now, let’s take a closer look at how flip-flops work.

How a Flip-Flops Works

In electronics, feedback is a process that involves feeding a portion of the output signal back into the input of the circuit. This feedback is crucial for controlling the behavior of the circuit and storing data. 

Flip flops utilize feedback loops to store data, and while they can come in many shapes and sizes, they all have this in common. Flip-flops use two feedback loops — the ‘set’ loop and the ‘reset’ loop — which connect to the flip-flop’s inputs to store data. The input signals determine the specific output state of the flip-flop.

The SR Latch

The basic building block of a flip-flop is a latch, which is a circuit that can store a single bit of data. A latch can be made using two NOR gates or two NAND gates. In a NOR latch, the output of one gate is connected to the input of the other gate, and vice versa. 

flip-flop in electronics
A latch can be made using two NOR gates or two NAND gates.

When the input to one of the gates is 0, it causes the output of the other gate to be 1, which keeps the circuit in a stable state. However, when both inputs are 1, the circuit becomes unstable, and the output can flip from 1 to 0 or vice versa.

A flip-flop is made up of two latches, connected in a feedback loop. This feedback loop ensures that the output of the flip-flop remains in one of the two stable states until a trigger (a signal) is applied to change the state. The input to the flip-flop is connected to one of the latches, while the output is taken from the other latch.

The flip-flop stores a ‘1’ when the ‘set’ input triggers and stores a ‘0’ when the ‘reset’ input triggers. After the flip-flop is set or reset, it stays in that state until triggered again.

Now that we understand how a flip-flop works, let’s take a look at the different types of flip-flops.

1. SR Flip-Flop

The SR flip-flop is the simplest type of flip-flop. And as you probably know or might have already guessed, SR stands for “set” and “reset”. It has two inputs, ‘S’ and ‘R’, and two outputs, ‘Q’ and ‘Q̅’. As with latches, based on the logic gates used, we can have two types of SR Flip-Flops: NOR and NAND flip-flops.

flip-flop in electronics
The SR flip-flop is the simplest type of flip-flop.

Both types of flip-flops have the same basic functionality, which is to store a single bit of data, but they have slightly different truth tables. Of the two, the NOR SR flip-flop is the more commonly used type. 

NOR Type

The SR flip-flop’s truth table below shows the output values for each possible combination of input values for the ‘set’ and ‘reset’ inputs. 

SRQ
00Q
1010
0101
11XX

When S is set to 1 and R is set to 0, the output Q is set to 1 and Q̅ is, of course, set to 0, and so on. Of importance to note is that when both the ‘set’ and ‘reset’ inputs are ‘1’, the output values are undefined (‘X’) or not allowed.

It’s instructive to note that this is the one major limitations of SR flip-lops. In the undefined state, the flip-flop’s output is unpredictable. To understand why, let’s first talk about propagation delay. Propagation delay is the time it takes for a signal to propagate through a circuit from the input to the output.

It’s an important parameter that determines the maximum clock frequency at which the flip-flop can operate correctly (note that SR flip-flops are unclocked). When both inputs are set to 1, the output changes from 0 to 1 and back to 0 again, due to the propagation delay of the gates.

The output can oscillate between the two states indefinitely, introducing race conditions and causing problems in digital circuits, such as excessive power consumption and false triggering of downstream circuits. This is why the undefined flip-flop state is undesired in electronics.

NAND Type

Meanwhile, the less commonly used NAND SR flip-flop functions the opposite way to the NOR flip-flop. is the opposite of the NOR flip-flop. In fact, the truth table for the NAND SR flip-flop is the inverse of that for the NOR SR flip-flop.

Q
00XX
1001
0110
11Q

When both inputs are set to 1, the output Q is set to 1 and Q̅ is set to 0, and so on. As we expect, when both S̅ and R̅ are set to 0, the flip-flop enters an undefined state.

To avoid this undesired undefined state in SR flip-flops, it’s imperative to design the circuit such that both inputs are never set to 1 at the same time. One common method to achieve this is to use clocked flip-flops, such as the D flip-flop, as such has more predictable behavior and is less prone to oscillation.

2. D Flip-Flop

Unlike other flip-flops, the D flip-flop has only one input (D). You’ll find some sources referring to it as the “Data or “Delay” flip-flop. It’s clocked and the clock input is commonly labeled ‘CLK’.

flip-flop in electronics
The D flip-flop has only one input (D).

The write pulse (clock input) transfers the input data (D) to the output (Q). In the (unclocked) SR flip-flop, input is immediately transferred to the output as it doesn’t have to wait for the clock pulse, unlike the D flip-flop. This is the cause of the delay.

What’s interesting about the D flip-flop is that when the clock input transitions from low to high i.e. 0 to 1, the D input is ‘sampled’ and the output of the flip-flop is updated. In simple terms, when the D input is triggered, the flip-flop stores the value of ‘D’. To better understand this, let’s have a look at its truth table. 

DCLKQ
00Q
10Q
0101
1110

When the clock signal is ‘0’, the output values are the current state of the flip-flop (‘Q’ and ‘Q̅’). Conversely, when the clock is set to ‘1’, the output values are the input value (‘D’) and its complement (‘D̅’) for ‘Q’ and ‘Q̅’, respectively. 

This essentially means that the flip-flop can be used for 1-bit storage such that when multiple flip-flops are connected, they can collectively store larger amounts of data, such as 8-bit data (a byte).

This cool property shows the flip-flop’s utility in data storage and is the basis of memory storage in digital electronic systems such as shift registers.

3. JK Flip-Flop

The JK flip-flop is a staple in digital systems. Named after its inventor, Jack Kilby, it features two inputs and two outputs. 

flip-flop in electronics
The JK flip-flop has two inputs and two outputs.

It operates based on a simple set of rules: when both of its inputs (J and K) are low (0), the output remains unchanged, as its truth table shows. 

JKCLKQ
000Q
001Q
010Q
01101
100Q
10110
110Q
111Q

When one input is high (1) and the other is low, the output is set to 1 or 0, depending on the input. The real magic happens when both inputs are high, as the output toggles between its current state and its opposite state.

It’s an improvement on the SR flip-flop, with the added bonus of a toggle function. Its ability to store and manipulate data makes it a key component in digital circuits, such as counters. 

Applications of the JK Flip-Flop in Digital Electronics as Counters

A counter is a circuit that counts the number of pulses applied to its input, thus the number of times an event occurs. It can be built using a series of flip-flops connected in a chain.

Each flip-flop in the chain represents a single bit of the counter. When the counter receives a pulse, the state of the flip-flops changes, and the output of the counter reflects the new count.

One example is a binary ripple counter. This type of counter uses a chain of flip-flops to count binary numbers. Each flip-flop represents a single bit of the number being counted, with the least significant bit at the beginning of the chain and the most significant one at the end of the chain.

When a clock signal is applied to the counter, the least significant bit changes state on each clock pulse. When the least significant bit goes from a ‘1’ to a ‘0,’ the next bit in the chain toggles its state. This process continues until the most significant bit has toggled its state, indicating that a full count has been reached.

4. T Flip-Flop

The T flip-flop has just one input (T) and two outputs.

flip-flop in electronics
The T flip-flop is useful for tasks like counting or generating a clock signal,

Here’s the truth table for a T flip-flop:

TCLKQ
0Q
1Q
TCLKQ

When the ‘T’ input is ‘0’, the output values are the current state of the flip-flop (‘Q’ and ‘Q̅’). When the ‘T’ input is ‘1’ and the clock signal transitions from a low to a high state (‘↑’), the output values toggle. If the flip-flop was storing a ‘1’, it will now store a ‘0’, and if it was storing a ‘0’, it will now store a ‘1’.

This makes the T flip-flop incredibly useful for tasks like counting or generating a clock signal. By connecting the output (‘Q’) to the clock input of another T flip-flop, you can easily create a binary counter that increments by one for every clock pulse.

The T flip-flop can also be used in combination with other logic gates to create more complex digital systems, such as registers and memory banks.

Flip-Flop in Electronics: The Wrap-Up

Flip-flops are essential building blocks in digital electronics. From synchronizing signals between different parts of a circuit to creating counters, shift registers, and memory units, they allow us to store and manipulate binary data, which is the foundation of all digital systems.

By understanding the different types of flip-flops and their applications in electronics, you should now be better equipped to design and build smarter, more efficient digital circuits.

Frequently Asked Questions

What is a flip-flop and what are the different types?

A flip-flop is a digital circuit that stores and manipulates binary data by having two stable states that can be changed through appropriate input signals. There are four basic types: SR, JK, D, and T flip-flops.

What’s a multivibrator and how’s it related to flip-flops?

A multivibrator is an electronic circuit that can generate a square wave signal. It can be constructed using two flip-flops in a specific configuration. Specifically, a multivibrator can be made using a set reset (SR) a JK flip-flop.

What's the difference between a latch and a flip-flop?

Latches change their output state continuously as long as their input signal remains stable, while flip-flops only change their output state at specific points in time (i.e. when a clock signal edge occurs).

What is a register in electronics?

A register is a group of flip-flops that can store a fixed number of bits of data. Registers are used in microprocessors and other digital systems to temporarily hold data that needs to be processed.

What is the difference between synchronous and asynchronous flip-flops?

Synchronous flip-flops need a clock signal to operate and change state only at specific points in time, whereas asynchronous flip-flops don’t require a clock signal and can change state whenever their input signals meet specific conditions.

What’s the major role of flip-flops in computer electronics?

Computer CPUs (also referred to as microprocessors) contain numerous flip-flops. Flip-flops play a critical role in storing the outcomes of logical and arithmetic operations, storing program counter values, and other data needed for processing instructions.

To top