# designing 3-bit counter with one D, one T and one JK

#### tekfiz

Joined Jun 21, 2023
8
Hello. i am new to electronics. I can count from 0 to 7 and from 7 to 0 with a 3-bit counter with JK flip flop. How can we make a counter that can count forward (0-7) when 1 is applied to the input and backwards (7-0) when 0 is applied to the input, with 1 D, one T and one JK flip flop?

#### MrChips

Joined Oct 2, 2009
29,802
What do you know about the functional characteristics of a D-type, T-type, and JK-type flip-flop?

#### tekfiz

Joined Jun 21, 2023
8
What do you about the functional characteristics of a D-type, T-type, and JK-type flip-flop?
design a switching circuit using a D flip-flop to control the forward and backward counting.
A T flip-flop can be used to increment the counter by one unit on each CLK signal in the forward counting case, while a JK flip-flop can be used to decrement the counter by one unit on each CLK signal in the backward counting case.

#### WBahn

Joined Mar 31, 2012
29,481
Hello. i am new to electronics. I can count from 0 to 7 and from 7 to 0 with a 3-bit counter with JK flip flop. How can we make a counter that can count forward (0-7) when 1 is applied to the input and backwards (7-0) when 0 is applied to the input, with 1 D, one T and one JK flip flop?
Can you do this if you could choose to use your choice of flip flop types?

If so, then pick whichever type you like and do the design accordingly.

Let's say that you choose to use D-type flip flops. Can you make a circuit using a T-type flip flop that behaves like a D-flip flop? Can you do that with a JK-type flip flop?

If so, then you are done.

#### WBahn

Joined Mar 31, 2012
29,481
design a switching circuit using a D flip-flop to control the forward and backward counting.
A T flip-flop can be used to increment the counter by one unit on each CLK signal in the forward counting case, while a JK flip-flop can be used to decrement the counter by one unit on each CLK signal in the backward counting case.

But, more to the point, it sounds like you are thinking that you need one flip flop to increment the counter and a different flip flop to decrement it. Why do you need a flip flop for either of these tasks?

You have a 3-bit up/down counter. Each bit requires one flip flop. You are supposed to use at least one of each of the three types of flip flops.

#### tekfiz

Joined Jun 21, 2023
8

But, more to the point, it sounds like you are thinking that you need one flip flop to increment the counter and a different flip flop to decrement it. Why do you need a flip flop for either of these tasks?

You have a 3-bit up/down counter. Each bit requires one flip flop. You are supposed to use at least one of each of the three types of flip flops.
Can we use both at the same time?

Last edited:

#### tekfiz

Joined Jun 21, 2023
8
3 flip-flops need to be used in the design.

#### MrChips

Joined Oct 2, 2009
29,802
The question I am asking refers to an algebraic equation that gives the result of Q on the next clock pulse based on the inputs D, T, and J and K.

For example, the equation for a D-type flip-flop is

Qnext = D

#### tekfiz

Joined Jun 21, 2023
8
The question I am asking refers to an algebraic equation that gives the result of Q on the next clock pulse based on the inputs D, T, and J and K.

For example, the equation for a D-type flip-flop is

Qnext = D
İ dont have a idea

#### MrChips

Joined Oct 2, 2009
29,802
If you do not know the equations for a flip-flop, here are the equations for the three types of flip-flops in question:

D-type flip-flop
$$Q_{next} = D$$

T-type flip-flop
$$Q_{next} = T\bar Q + \bar TQ$$

J-K flip-flop
$$Q_{next} = J\bar Q + \bar KQ$$

https://en.wikipedia.org/wiki/Flip-flop_(electronics)

• tekfiz

#### MrChips

Joined Oct 2, 2009
29,802
The next thing that you need to read about is how to design a finite state machine.

For example, suppose you want to create a synchronous counter that counts from 0 to 7.
You create a truth-table of all the possible states, showing the current state and the next state.

now -> next
C B A -> C' B' A'
0 0 0 -> 0 0 1
0 0 1 -> 0 1 0
0 1 0 -> 0 1 1
0 1 1 -> 1 0 0
1 0 0 -> 1 0 1
1 0 1 -> 1 1 0
1 1 0 -> 1 1 1
1 1 1 -> 0 0 0

• tekfiz

#### WBahn

Joined Mar 31, 2012
29,481
Can we use both at the same time?
The question doesn't make sense.

You need three flip flops. Call them FF1, FF2, and FF3.

You need to make FF1 a DFF, FF2 a TFF, and FF3 a JKFF.

• tekfiz

#### MrChips

Joined Oct 2, 2009
29,802
How to design a finite state machine

In this example of three flip-flops, there are three outputs QA, QB, QC.
We ignore for the moment what type of flip-flop will be used to implement each output.
We focus on a single output, for example QC.

now -> next
C B A -> C B A
0 0 0 -> 0 0 1
0 0 1 -> 0 1 0
0 1 0 -> 0 1 1
0 1 1 -> 1 0 0
1 0 0 -> 1 0 1
1 0 1 -> 1 1 0
1 1 0 -> 1 1 1
1 1 1 -> 0 0 0

We identify what present state will produce a 1 on the next clock pulse.
now -> next
C B A -> C
0 1 1 -> 1
1 0 0 -> 1
1 0 1 -> 1
1 1 0 -> 1

We can identify four states that produce a 1 on the next clock pulse.
We write out the boolean equation that will produce a 1.

In this notation, I will use ' to mean NOT.

Qc = AB’C + 'A'BC + A'BC +'ABC

We attempt to reduce this to the simplest logic function. But before we do that, you need to learn how to create a Karnaugh map.

• tekfiz

#### tekfiz

Joined Jun 21, 2023
8
How to design a finite state machine

In this example of three flip-flops, there are three outputs QA, QB, QC.
We ignore for the moment what type of flip-flop will be used to implement each output.
We focus on a single output, for example QC.

now -> next
C B A -> C B A
0 0 0 -> 0 0 1
0 0 1 -> 0 1 0
0 1 0 -> 0 1 1
0 1 1 -> 1 0 0
1 0 0 -> 1 0 1
1 0 1 -> 1 1 0
1 1 0 -> 1 1 1
1 1 1 -> 0 0 0

We identify what present state will produce a 1 on the next clock pulse.
now -> next
C B A -> C
0 1 1 -> 1
1 0 0 -> 1
1 0 1 -> 1
1 1 0 -> 1

We can identify four states that produce a 1 on the next clock pulse.
We write out the boolean equation that will produce a 1.

In this notation, I will use ' to mean NOT.

Qc = ABC' + 'A'BC + A'BC +'ABC

We attempt to reduce this to the simplest logic function. But before we do that, you need to learn how to create a Karnaugh map.
please go on. it is very instructive.

#### WBahn

Joined Mar 31, 2012
29,481
please go on. it is very instructive.
This is YOUR homework assignment. It's time you started showing your best attempt to solve it. We can then help you identify issues you are having and suggest way to solve them. In the end, the bulk of the work needs to be done by you, not only because you are claiming academic credit for it, but more importantly because this is how you will best learn from the effort.

#### MrChips

Joined Oct 2, 2009
29,802
• tekfiz

#### MrChips

Joined Oct 2, 2009
29,802
We will use the 3-variable Karnaugh map in order to simplify this Boolean combinational expression.

now -> next
C B A -> C
0 1 1 -> 1
1 0 0 -> 1
1 0 1 -> 1
1 1 0 -> 1

Qc = AB’C + 'A'BC + A'BC +'ABC

We draw in 0 and 1 in the appropriate state boxes.
In another circuit design, we would enter don't care conditions with an X. Next, we group adjacent 1s, in groups of 2, 4, 8, etc. knowing that we are allowed to wrap around at the edges of the map.

This results in this reduced expression:

Qc = AB’C + 'BC +'AC

which can be further simplified to:
Qc = AB’C + ('B +'A)C

and by applying DeMorgan's equivalence:
Qc = AB’C + '(AB)C

We have now given you an expression for the Qc flip-flop. The next step is to implement this using any one of the three types of flip-flops. But before you do that, repeat the same exercise for the QA and QB flip-flop. Having done this, you might be able to choose a flip-flop that is best suited to the required expression.

• tekfiz