Counter using JK flip flop

Discussion in 'Homework Help' started by meringue15, Mar 13, 2017.

  1. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    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
     
  2. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    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.
     
    meringue15 likes this.
  3. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    Thank you for the warm welcome!

    What do you mean by different counting sequence?
     
  4. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    A courtesy that the person responding to your first, or early, post has the privilege of offering.
    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,...
     
  5. WBahn

    Moderator

    Mar 31, 2012
    24,075
    7,473
    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,....
     
  6. meringue15

    Thread Starter New Member

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

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    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.
     
  8. WBahn

    Moderator

    Mar 31, 2012
    24,075
    7,473
    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.
     
  9. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    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).
     
  10. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    I kind of get it now. I was just, like dl324 said, getting bogged down by semantics.

    Can I see the design? I'm going to start working on the counter later and it might help me.
     
  11. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    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.
     
  12. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    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?
     
  13. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    How would you have handled the illegal counts in a state diagram?

    Post your truth table.
     
  14. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    Here's my truth table.
    STATE TABLE.PNG
     
  15. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    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.
     
  16. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    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!
     
  17. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    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?
     
  18. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    Oh! Does that mean I'll use don't cares for the invalid counts like 30 and 31?
     
  19. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,258
    1,989
    That's one option. What does your instructor normally do?
     
  20. meringue15

    Thread Starter New Member

    Mar 13, 2017
    14
    0
    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.
     
Loading...