# Building a D flip-flip counter with this sequence:

#### Alex002

Joined Dec 11, 2011
6
Ok, I have at least 20 hours on this and it's not turning out. I feel like I know exactly what to do though. Would really appreciate if someone could point out the error in my method.

Objective: Counter from 1 to 12 using Two Hex displays. So when it hits 10 the first display will show 1 and the second will show 0.

This is how the circuit should act:

Display 1: 0 - 0 - 0 - 0 - 0 -0 - 0 - 0 - 0 - 1 - 1 - 1 - RESET TO 0
Display 2: 1 - 2 - 3 - 4 - 5 -6 - 7 - 8 - 9 - 0 - 1 - 2 - RESET TO 1

However, I was having so much trouble I decided to try to just do the sequence for display 2, and I still can't get it to work right.

My current circuit counts to 9 and then goes back to zero. So that's a problem.

For example, here is the resulting input circuit for D: I used the program Logic Friday to enter the truth table.

#### Georacer

Joined Nov 25, 2009
5,182
If you want to build two separate counters for each digit, you can check this tutorial out: http://www.allaboutcircuits.com/vol_4/chpt_11/5.html

If you want to use a standard 4-bit D-Flip Flop counter, I suggest you rig it so that it resets when it reaches 1101 (13) and decode the binary output into two 4-bit BCD output vectors.

#### Alex002

Joined Dec 11, 2011
6
I have been following that tutorial for days now. I don't need the input I and output Y columns right? Otherwise I just don't see what I'm doing wrong. Are my tables wrong?

Last edited:

#### Georacer

Joined Nov 25, 2009
5,182
Okay. You have 4 input bits. You want two groups of 4-bit outputs. That leaves you with 8 output Boolean functions.

That means that you have to build and reduce (through a K-map) 8 Boolean functions of the 4 input bits.

You can also "cheat" a bit and do the following. Create the 4 boolean functions for the units Hex display and since your second display will show either 0 or 1, you can build only one boolean function FMSB=Σ(10,11,12).
For example:
Rich (BB code):
A B C D | X Y1 Y2 Y3 Y4
1 1 0 0 | 1 0  0  1  0
X is your decades signal and Y is the units BCD hex display.

Is that clear?

The 74185 chip is designed for this purpose too: http://pdf1.alldatasheet.com/datasheet-pdf/view/98235/TI/SN74184.html

#### Alex002

Joined Dec 11, 2011
6
I believe I was trying to "cheat" in the exact way you are saying. So I'm trying to ignore the first display for now, and build the circuit that drives the second display. Then like I think you said I can just use gates to turn it on when the output is 10,11,12.

So yes, that is very clear. In my tables above, I am trying to build the 4 input functions for the 4 d flip-flops. However, I am wondering if my tables are wrong because the circuit goes to 9 and then goes to 0 (Like it should!, except the output should be 10 instead of 0) .

#### Georacer

Joined Nov 25, 2009
5,182
No, you have misunderstood here. You will build a normal D-FF counter that will count up to 12 and then reset. That counter will have a binary output.

Afterwards, you will build a second circuit that will translate the binary output of the counter to a BCD display.

#### Alex002

Joined Dec 11, 2011
6
Ok, that make sense. I'll start building the first circuit right now.

How would I go about building the second circuit?

Edit: Ok, I have successfully built the first circuit which counts from 0-12 then resets back to 1 . It outputs the binary sequence.

Last edited:

#### Georacer

Joined Nov 25, 2009
5,182
For the units display, you need to implement a truth table that will resemble like this:
Rich (BB code):
A B C D | Y1 Y2 Y3 Y4
0 0 0 0 | 0  0  0  0
0 0 0 1 | 0  0  0  1
...
1 0 1 1 | 0  0  0  1
1 1 0 0 | 0  0  1  0
For the decades, you need to detect, as I told you before, the inputs 10, 11 and 12.

Post the truth table here for review.

Last edited:

#### Alex002

Joined Dec 11, 2011
6
Ok here is how I did it:

B2D just takes the binary input and activates the corresponding output. So if 1010 came in, o10 would be active.
decToDisplay is just a bunch of OR gates that activate the correct lines into the display. So if i10 came in: only Display 2 Line 1 would be active.

#### Georacer

Joined Nov 25, 2009
5,182
I like your solution. You didn't use a K-map and came up with something bigger but simpler. You used a ready-made decoder for its first part. That relieves you from having to build extended logic circuits. The OR network is rather simple.

So, in theory, your circuit works, but that actually depends on the accuracy of the OR network design. Do you want to leave it as a black box or you will go ahead and actually design it?

#### Alex002

Joined Dec 11, 2011
6
This is how I designed the decToDisplay circuit:

I made a chart of each display input line and which decimal numbers should activate them:

Then I just drew it out with a bunch of OR gates.

#### Georacer

Joined Nov 25, 2009
5,182
Yep, that should do the trick.