4-bit binary counter using D flip-flops (modulo 15)

Thread Starter

daniel_b95

Joined Dec 3, 2017
4
Hey guys :D
So I got this final project for my classes and I need to design a 4-bit counter counting up from 0 to E. I managed to come up with these boolean expression tables but I'm not sure if they're correct because when I built the counter in Electronics Workbench it wasn't working correctly so I'm not sure if the fault was my tables or my circuit. Please note, I did truth tables for each D, but I'm not posting them for now since if the table below is wrong then no point in posting them.

If you could please look at the tables or tell me if it should be done differently.


 

dl324

Joined Mar 30, 2015
16,922
Welcome to AAC!

Post your Kmaps, equations, and the count sequence you're getting.

What were you taught about don't cares?

You'll find it easier to transfer data to Kmaps if you order the rows of your table in gray code format.
 

Thread Starter

daniel_b95

Joined Dec 3, 2017
4
Hi, thanks for welcoming me.
About don't cares? For me that means those "Xs" in K-maps that can be used as "1" to help minimize functions better, and also they are inserted in the spots where there's no expression I guess.

Output on my counter is: 0-8-A-C-E and it goes around like that

My K-maps and equations.

 

MrChips

Joined Oct 2, 2009
30,809
Your procedure looks correct.
Post your circuit schematic and check over your work.
In particular, look to see why Q3 and Q0 are not changing state.
 

dl324

Joined Mar 30, 2015
16,922
About don't cares? For me that means those "Xs" in K-maps that can be used as "1" to help minimize functions better, and also they are inserted in the spots where there's no expression I guess.
You should be putting the don't cares in your table so it's apparent where they came from in your Kmaps.

When the count is 0, examine the inputs to D3 and D0.
 

Thread Starter

daniel_b95

Joined Dec 3, 2017
4
Ok guys, I'm very happy because it's finally working. The problem was my circuit, I did it the third time from scratch and it's working flawlessly :D
Thank you for your time, taken to check my tables and reply. I really appreciate it!

You should be putting the don't cares in your table so it's apparent where they came from in your Kmaps.
Will keep that in mind, it seems like a better way.

I'll just paste my circuit in case someone ever has the same problem and might find it useful. It's not perfect aesthetically, but works.

 

MrChips

Joined Oct 2, 2009
30,809
You should refrain from doing things over from scratch.

Did you save your initial attempt that was not working?
Did you learn from your mistake as to what you did wrong to cause it not to work?

You learn more from your mistakes than from what you do right.
 

dl324

Joined Mar 30, 2015
16,922
The problem was my circuit, I did it the third time from scratch and it's working flawlessly
Take @MrChips advice and learn to troubleshoot your designs. I usually double and triple check my work and still manage to make mistakes. You can use the usual troubleshooting techniques to determine the cause of any problems. Those skills will help you when working on any design.

Neatness counts in schematics:
upload_2017-12-3_9-47-39.png
 

Thread Starter

daniel_b95

Joined Dec 3, 2017
4
You should refrain from doing things over from scratch.

Did you save your initial attempt that was not working?
Did you learn from your mistake as to what you did wrong to cause it not to work?

You learn more from your mistakes than from what you do right.
Right, I should've thought about that.
Yes, I've learned from my mistake that I should check my work each step of the way and to keep schematics clean and easily readable. And the next time I should double or triple check before posting threads :c it's just it was the first time I was doing those things and I wasn't even sure if I approached it right. Turns out I have a lot to improve on.
Thank you for advice
 

dl324

Joined Mar 30, 2015
16,922
Turns out I have a lot to improve on.
Your work is among the cleanest I've seen in Homework Help.

Your schematic was by far one of the cleanest drawn by a student. You knew that it wasn't aesthetically pleasing, so you already know the problems in it. If you devote some time to aligning components, laying them out consistently, and avoiding unnecessary jogs and scenic routing; your schematics will look like they were drawn by a professional.

The "style" you used, which happens to be very close to mine, isn't the best for conveying functionality; but I consider it useful for getting the logic laid down in an orderly fashion that's easy to troubleshoot. Once the circuit is working, I worry about logic simplification and arranging the gating logic to convey function. For problems in Homework Help, I rarely do that because they're done as a vehicle for guiding students.
 

WBahn

Joined Mar 31, 2012
30,060
Right, I should've thought about that.
Yes, I've learned from my mistake that I should check my work each step of the way and to keep schematics clean and easily readable. And the next time I should double or triple check before posting threads :c it's just it was the first time I was doing those things and I wasn't even sure if I approached it right. Turns out I have a lot to improve on.
Thank you for advice
Everyone has things they can improve on and newcomers to a field of study will always have that in spades. Sometimes starting from scratch is the best solution left, but that usually (not always) is a strong indicator that the work up to that point was going off the rails for some time, or that the skills and patience to work with the existing design are not in place.

As noted by others, it is usually worth spending some time and effort troubleshooting a design. The goal is to identify what portions work and what portions don't and, for those that don't, to identify how they don't work or at least at what point they stop working. You can aid this tremendously by designing and building your project with these goals in mind. Many schematics (and much more so breadboarded circuits) are a nightmare to work with because they are laid out so sloppily with a "just get it done" mindset. Spend the time to make them neat and easy to work with. Not only will you be able to trouble shoot and repair them much more readily, but whoever is evaluating the work (a grader today and a supervisor or customer tomorrow) will reward your efforts one way or another.

As also noted by others, you are far further down the correct road than so many of the folks that come here and you seem to have the right attitude. You'll do just fine.
 

dl324

Joined Mar 30, 2015
16,922
This is what I meant when I said to order your table in gray code format:
upload_2017-12-4_8-24-26.png
This has the advantage of being able to transfer the data to Kmaps without having to think much about it.

True color of the Kmap above:
upload_2017-12-4_8-25-55.png
I color code the groupings. The order of the terms in the equation is orange, blue, purple. The darker orange indicates that those minterms also group with the blue.
 

WBahn

Joined Mar 31, 2012
30,060
This has the advantage of being able to transfer the data to Kmaps without having to think much about it.
The disadvantage is that the problem naturally lends itself to a binary ordering of the table. Putting it in Greyscale order makes it easier to make mistakes and harder to catch them at that point. So there's a pro and con to each approach and no "best" approach.

Personally (and it IS personal preference, by and large) I like to divorce the problem solution from the implementation process as much as possible. Get the basic truth table (or equations or whatever) that achieves the goal of the problem as cleanly as possible. Everything else is implementation details. I don't like to mix them if I can avoid it so that my mind can focus on them one at a time.
 
Top