Counter using JK flip flop

Thread Starter

meringue15

Joined Mar 13, 2017
14
We are required to create a Modulo Counter that counts from 29 to 0 using a JK flip flop. I know how to start making one (state table, state diagram so and so) but I was wondering if there's a difference between the following:
  • modulo counter
  • bcd counter
  • binary counter
If so, what are their differences?

Here's what our professor wanted us to do per group and we're group 7. I couldn't seem to understand how modulo differs from the others.
final proj.PNG
 

dl324

Joined Mar 30, 2015
18,328
Welcome to AAC!

They're all just different names for the same thing - counters. BCD, binary, and modulo counters are just counters with different counting sequences.

You could call a BCD counter mod10, a 4 bit binary counter could be called mod16, a 5 bit binary counter could be called mod32. Your counter could be called mod30.
 

Thread Starter

meringue15

Joined Mar 13, 2017
14
Welcome to AAC!

They're all just different names for the same thing - counters. BCD, binary, and modulo counters are just counters with different counting sequences.

You could call a BCD counter mod10, a 4 bit binary counter could be called mod16, a 5 bit binary counter could be called mod32. Your counter could be called mod30.
Thank you for the warm welcome!

What do you mean by different counting sequence?
 

dl324

Joined Mar 30, 2015
18,328
Thank you for the warm welcome!
A courtesy that the person responding to your first, or early, post has the privilege of offering.
What do you mean by different counting sequence?
BCD: 0,1,2,3,...,9,0,1,...
4 bit binary: 0,1,2,3,...,9,10,11,...,15,0,1,...
5 bit binary: 0,1,2,3,...,9,10,11,...,15,16,17,18,...,30,31,0,1,...
 

WBahn

Joined Mar 31, 2012
32,840
A 2-bit UP counter is going to count in the following sequence: 0,1,2,3,0,1,2,3,....

A mod-5 UP counter is going to count in the following sequence: 0,1,2,3,4,0,1,2,3,4,....
 

Thread Starter

meringue15

Joined Mar 13, 2017
14
I understand. What about for the modulo counter, then? Isn't it the same for the 5-bit binary counter? I'm getting confused..
 

dl324

Joined Mar 30, 2015
18,328
I understand. What about for the modulo counter, then? Isn't it the same for the 5-bit binary counter? I'm getting confused..
A 5 bit binary counter can also be called a mod32 counter. You're getting bogged down by semantics.

You could have already designed your counter by now.
 

WBahn

Joined Mar 31, 2012
32,840
I understand. What about for the modulo counter, then? Isn't it the same for the 5-bit binary counter? I'm getting confused..
A mod-N counter simply counts from 0 to N-1 and then repeats. The value of N can be any integer greater than 1 (a mod-1 counter is particularly boring).

An n-bit counter is simply a mod-2ⁿ counter. So a 5-bit counter is a mod-32 counter.
 

dl324

Joined Mar 30, 2015
18,328
Here's what our professor wanted us to do per group and we're group 7. I couldn't seem to understand how modulo differs from the others.
Your group got lucky.

For fun, I did the design for your counter, but I designed the up version instead of down. The logic for the down counter is somewhat simpler than the up counter (using JK FF not D).
 

Thread Starter

meringue15

Joined Mar 13, 2017
14
A mod-N counter simply counts from 0 to N-1 and then repeats. The value of N can be any integer greater than 1 (a mod-1 counter is particularly boring).

An n-bit counter is simply a mod-2ⁿ counter. So a 5-bit counter is a mod-32 counter.
A 5 bit binary counter can also be called a mod32 counter. You're getting bogged down by semantics.

You could have already designed your counter by now.
I kind of get it now. I was just, like dl324 said, getting bogged down by semantics.

Your group got lucky.

For fun, I did the design for your counter, but I designed the up version instead of down. The logic for the down counter is somewhat simpler than the up counter (using JK FF not D).
Can I see the design? I'm going to start working on the counter later and it might help me.
 

Thread Starter

meringue15

Joined Mar 13, 2017
14
That's not how it works. You show us your best effort and we try to guide you to the solution using the technique your instructor is teaching you.
Alright. I just tried solving for it and I was wondering if I did it right..

I started with the state table (doing the state diagram would eat a lot of time) and I began with 11111 for the present state down to 00000. The next state for 11111 and 11110 would be 11101. Does that mean, all the LED lights will light up at first then start counting down from 11101 to 00000? If so, is there any way for it to start at 11101 immediately?
 

dl324

Joined Mar 30, 2015
18,328
What were you taught about don't cares?

Thank you for posting a readable table. You'll find that drawing horizontal lines every 4 rows will help you read the rows when it comes time to transfer information to Kmaps. You'll also find that arranging your rows in gray code order will help.
 

Thread Starter

meringue15

Joined Mar 13, 2017
14
What were you taught about don't cares?

Thank you for posting a readable table. You'll find that drawing horizontal lines every 4 rows will help you read the rows when it comes time to transfer information to Kmaps. You'll also find that arranging your rows in gray code order will help.
As far as I know, don't cares can help shorten a Boolean expression when it comes to Kmapping. Like, it can be ignored or used as 1.

Oh, I see. Thank you for the tip!
 

dl324

Joined Mar 30, 2015
18,328
As far as I know, don't cares can help shorten a Boolean expression when it comes to Kmapping. Like, it can be ignored or used as 1.
If you were designing an odd counter, e.g. 1,3,5,..., what would you do for the rows for even counts? Wouldn't you do something similar for invalid counts in your counter?
 

Thread Starter

meringue15

Joined Mar 13, 2017
14
If you were designing an odd counter, e.g. 1,3,5,..., what would you do for the rows for even counts? Wouldn't you do something similar for invalid counts in your counter?
Oh! Does that mean I'll use don't cares for the invalid counts like 30 and 31?
 

Thread Starter

meringue15

Joined Mar 13, 2017
14
That's one option. What does your instructor normally do?
Well, he'd probably use don't cares for the invalid counts. He only gave us one example and that was a 3-bit up counter so creating a Mod counter that counts from 29 to 0 is kind of hard considering the fact that I'm self-studying.

But, is what I did alright too? Present state is 11111 and the next state would be 11101. Or will that cause problems?

I will try to create another diagram using don't cares for invalid counts.
 
Top