# Up/down Decade counter using D Flipflop

Discussion in 'Homework Help' started by fordelon1, Aug 24, 2011.

1. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
Hi..
I do have a question how to do this, it must be a 4bit decade counter.. that counts from 0-99, up and down... and can be reset to 0. All of this using D flip flops
no luck searching the web, all i can see are JKFF and TFF...

2. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
You'll need to build two 4-bit decade counters then; as a 4-bit decade counter can only store a number from 0 to 9.

Here is a Wikipedia entry on flip-flops; the D-type F/F is mentioned:
http://en.wikipedia.org/wiki/Flip-flop_(electronics)

An educational site on D-type f/f's:
http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/dflipflop.html

A 4000-series CMOS D-type flip flop:
http://www.nxp.com/documents/data_sheet/HEF4013B.pdf

A 74-series TTL D-type flip flop:
http://www.learn-c.com/74ls74.pdf

3. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
thank you for your fast response..
yes, i know the basic of D flip flop..

can you give me some of the idea how to start in K-Mapping or building the schematic diagram..

I appreciate any answer from you sir.

4. ### keithisdoped New Member

Aug 22, 2011
14
0
irrelevant!

good luck

Last edited: Aug 24, 2011
5. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
but we was instructed to build this circuit strictly using D Flip flop only
of course with the help of basic logic gates, the clock timer, and the 7447..

any idea?

6. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
I will get you started on how to make a decade counter, but you will have to do some of the work yourself.

Firstly, you will need four flip-flops of any kind since you will need four bits for 0-9.
Next you create a table showing all the possible states you can have with four bits.
On the next column you write down the next state of the 4-bit counter. For example, 3->4
When a state is not applicable, write down X to mean "don't care"

Here is the partial table:

DCBA DCBA(next state)
0000 0001
0001 0010
0010
0011
0100
0101
0110
0111
1000
1001 0000
1010 xxxx
1011 xxxx
1100
1101
1110
1111

I will leave it up to you to fill in the missing lines.

Next, you need to draw four separate Karnaugh maps, one for each flip-flop
Take for example, the A-flip-flop. Enter into each of the 16 squares of the map the next state of the A-flip-flop: 0, 1 or X. For example, in state 0000, the next state of A will be a 1. For state 0001, the next state is 0. For state 1010, the next state is X.

Next step, reduce the Karnaugh map to a boolean equation, and then into a circuit diagram.

If you have gotten this far, you are doing well.

To be continued.

anhnha and keithisdoped like this.
7. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
if x=0; it is an up counter if x=1; it is a down counter.
Z would be the trigger for the TENS
PS NS Z

DCBA x=0 x=1 x=0 x=1
0000 0001 1001 0 1
0001 0010 0000 0 0
0010 0011 0001 0 0
0011 0100 0010 0 0
0100 0101 0011 0 0
0101 0110 0100 0 0
0110 0111 0101 0 0
0111 1000 0110 0 0
1000 1001 0111 0 0
1001 0000 1000 1 0
1010 xxxx xxxx x x
1011 xxxx xxxx x x
1100 xxxx xxxx x x
1101 xxxx xxxx x x
1110 xxxx xxxx x x
1111 xxxx xxxx x x

Is my truth table correct?...

more power to you sir..

8. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
Firstly, let's not use x to mean UP/DOWN. Use a different symbol such as DIR.

I have purposely not included UP/DOWN because I wanted to make sure you understood how to do a simple 0-9 counter first. Also for the same reason let us not worry about the 2-digit counter at this point.

However, yes, your truth tables for both UP and DOWN are correct.
Read up first on Karnaugh mapping and then I will show you how to do one.

anhnha likes this.
9. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
KMAP for A...

B'A'x' B'A'x B'Ax B'Ax' BAx' BAx BA'x BA'x'

D'C' 0 1 0 0 0 0 0 0
D'C 0 0 0 0 1 0 0 0
DC x x x x x x x x
DC' 1 0 1 0 x x x x
(I'm having a difficulty in spacing, but i think you can get this one)
I'm having a hard time simplifying a Kmap even though I know it's basic concept, can you help me with their KMAP..

Thank you for your good response sir...

10. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
Sir, If you can allow me,
can you please post their Individual [4]simplified boolean..

so i can check and compare my work with yours.
only if you can allow me sir?

thank you..

11. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
Nope. You show me your work first.

12. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
Here is the Karnaugh map for flip-flop "A".

There are many ways to draw a K-map. If drawn correctly they will all reveal the same solution.

The important thing to note is - when moving from one square to an adjacent square, only a single bit in the square number changes state - i.e. Gray Code is used.

Another thing to note is that the map can be visualized as a complex cylinder that can be wrapped around in both the horizontal and vertical axes. For example, square #0 wraps around with square #2 and with square #8.

Now, you show the Karnaugh maps for bits B, C and D. I am not going to do them for you.

Later I will show you how to reduce the map to the simplest boolean equation and circuit, if you do not already know how to do so.

Last edited: Aug 25, 2011
anhnha likes this.
13. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
Thank you for your response MrChips, yes I've done plotting the 4 KMaps, A B C and D...
my problem is in simplifying the boolean algebra for all of them, it seems that i have a difficulty in grouping variables and simplify them...

14. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
Do you know how to arrive at a solution for the K-map I have shown?

15. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
is the answer A' ?... i have a difficulty in simplifying a KMap... the first and fourth column are grouped together...

16. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
Yes, that is correct. Now show your work for the other flip-flops.

17. ### fordelon1 Thread Starter New Member

Aug 16, 2011
13
0
but my design has an input which is DIR[specifies up/down counter]... so my variables are
A, B, C, D and DIR.. i need a 5 variable, a total of 32 blocks in K-map..

18. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
Like I said, make sure you can do the simple UP counter first before moving on. Remember, proper learning requires taking one step at a time.

Aug 16, 2011
13
0
B= da'
c= ca'
d= cba

20. ### MrChips Moderator

Oct 2, 2009
12,636
3,454
I did not get the same answers as you did.