# Applications of Flip Flops

concept
In this topic we're going to cover some of the most common uses of flip flops in digital circuits. These uses include:
• slowing down a clock (important for many communications between different digital circuits that run at different speeds)
• Building counters

## Frequency Division

In digital circuits faster clocks means faster computations but when two different circuits have to communicate they often need to share a clock signal to know how fast to read or write data. So if you have a very, very fast circuit but you need to talk to a much slower circuit that can't handle your clock you'll need to create a new clock that's slower. We call this "Frequency Division" and you can easily do it using flip flops.
fact
Frequency Division means lowering the speed of a signal, usually a clock.
fact
To halve the frequency of a clock we connect it to a flip flop in one of the following two ways: The result is a clock signal with half the frequency it had originally
fact
If we connect the output of one flip flop to the input of a second also set up to divide frequency we can divide the clock frequency even more:
fact
With $$n$$ flip flops connected in series the output frequency of the clock will be $$\frac{1}{2^n}$$ of the original clock frequency.
example

A clock has frequency of 200Hz and is passed through 3 frequency dividing flip flops. What is the output clock frequency?

With 3 frequency dividers the total division is $$\frac{1}{2^3} = \frac{1}{8}$$. So our output frequency will be $$\frac{200}{8} = 25$$Hz
example

How many frequency dividers in series are needed to divide a clock frequency by 32?

Each divider halves the frequency so we need $$2^n = 32$$ $$n = \log_2(32) = 5$$ We will need 5 frequency dividers in series to divide our clock frequency by 32.

## Counters

Flip flops can be hooked up together to create a binary counter. On each clock cycle the number (which has as many bits as you use flip flops) will increment by one. Counters are very, very common elements of digital circuits and are covered in more detail in a later topic.
fact
Connected together, flip flops can be used to count the number of positive or negative edges in the clock signal. When the counter reaches its maximum value (all 1s) it will "recycle" back to all 0s and start again.
We use J-K flip flops wired permanently in toggle mode so that each time the clock has a rising edge the first flip flop changes state, then every time the first flip flop's output has a rising edge (every two clock rising edges) it triggers the second flip flop to toggle and so on.
practice problems