# Designing a 3-bit counter with D flip flops

Discussion in 'Homework Help' started by Mearyk81, May 31, 2008.

1. ### Mearyk81 Thread Starter New Member

May 31, 2008
3
0
I have officially reached my wits end.

I have been working on this project now for 20 hours and I have absolutely nothing to show for it except some holes in the walls (oops). My problem is thus:

Design a 3 bit counter using 3 D flip flops and one X input. When X is 0, the counter is supposed to count up in multiples of 2 (i.e. 000, 010, 100, 110, 000, etc.). When X is 1, the counter is supposed to count down by odd numbers (i.e. 111, 101, 011, 001, 111, etc.). If X is changed while the counter is going up, the circuit should go to the next lowest odd number on the next clock pulse. If X is changed while the counter is going down, the circuit should go to the next highest even number on the next clock pulse.

So there it is. I have designed state table after state table and I cannot find the correct logic to implement this counter to save my life. Any help would be greatly appreciated.

Thanks.

2. ### mik3 Senior Member

Feb 4, 2008
4,846
70
Convert your state tables to a truth table ,then make K-maps for each of your outputs and find the simplest SOP or POS solution.

3. ### Caveman Senior Member

Apr 15, 2008
471
1
You actually have a two-bit up/down counter based on X. The LSB is always equal to the last latched value of X.

4. ### Mearyk81 Thread Starter New Member

May 31, 2008
3
0
I must be utterly stupid because I don't understand any of this. And Caveman, I misrepresented the numbering system. It should probably look more like this:

0000 - 0010 - 0100 - 0110 - 0000
1111 - 1101 - 1011 - 1001 - 1111

The way in which it is counting is dependent on the X input.

To Mik:

I have converted my state table to a truth table but maybe I am doing it wrong. Let me see if I can explain how it looks.
HTML:
1.
2. X  Current State        Next State                 DFF1      DFF2     DFF3
3. 0  000                     010                      0          1        0
4. 0  010                     100                      1          0        0
5. 0  100                     110                      1          1        0
6. 0  110                     000                      0          0        0
7. 1  111                     101                      1          0        1
8. 1  101                     011                      0          1        1
9. 1  011                     001                      0          0        1
10. 1  001                     111                      1          1        1
11. 0  111                     000                      0          0        0
12. 0  101                     110                      1          1        0
13. 0  011                     100                      1          0        0
14. 0  001                     010                      0          1        0
15. 1  000                     111                      1          1        1
16. 1  010                     001                      0          0        1
17. 1  100                     011                      0          1        1
18. 1  110                     101                      1          0        1
19.
Is that correct so far?

5. ### Mearyk81 Thread Starter New Member

May 31, 2008
3
0
WOOOOOOOOHOOOOOOOOOOO!!!!!!

I finally got it!! Thank you so much for the replies. It definitely kicked my mind into overdrive and something just clicked.