Create Mod Counter Using Flip Flops: 5 to 2 Cycle

In summary, the conversation discusses creating a mod counter using flip flops and the issue of skipping certain states in the counting cycle. Different solutions are suggested, including manipulating the J and K inputs and implementing the next state equations for a JK flip-flop. The conversation also touches on the use of a time strobe and the need for a complex logic in the front part for proper control of the inputs. The conversation ends with the individual attempting to calculate the J and K inputs for their equations but being unsure of how to do so.
  • #1
surfy14
5
0

Homework Statement



To create a mod counter using flip flops that counts from 5 down to 2 and repeats this cycle...example 5, 4, 3, 2, 5, 4, 3, 2, 5, 4, 3, 2...

The Attempt at a Solution



I currently can get it to count from 7 down to 2 no problems...the issue is...I don't know how to skip states 7 and 6 right now. Using 3 jk flip flops...allows 2^3 states...or 0-7. Once the state reaches 1...I use an and gate to clear all the flip flops so that it jumps back to 7. Here is my schematic so far...but I'm assuming I have to somehow manipulate the j and k inputs to skip states 7 and 6; basically not hardwire a 1 to j and k. Any help would be appreciated...thanks.

http://www.freeimagehosting.net/newuploads/j92t9.jpg
 
Physics news on Phys.org
  • #2
Remove the inverter on the output hexD(1)
 
  • #3
ivanis said:
Remove the inverter on the output hexD(1)

that does start the counter at 5, but the order is 5, 4, 7, 6, 1, 0...it is not 5, 4, 3, 2
 
  • #4
You're right.
But I have another quick idea - you have to check it, sure.
What I was thinking that you are resetting with event "1", it means in fact that you will have this value on the output for a short time, right?

So I don't know if it's critical for you, but I'd rather reset on event "2" with a proper delay. This method has an advantage you can use to get your 5,4,3,2. because as you have "2" at the output it means "101" directly at the triggers. Now if you drop the first and the third trigger outputs with reset - the second will turn high on the negative slope of the first. it means after the reset you get "010", inverted into "101" at the output (dear value 5).

If you need a scheme, I can add a sketch of how it looks in my imagination.
Manipulating JK makes the scheme more flexible, but also much more complicated, let's try to avoid that.
 
  • #5
Why don't you do it properly? Implement the next state equations with appropriate JK inputs instead of setting them all 1. Using appropriate "don't cares" for the disallowed states results in very simple JK equations requiring no additional logic gates at all.
 
  • #6
LCKurtz said:
Why don't you do it properly? Implement the next state equations with appropriate JK inputs instead of setting them all 1. Using appropriate "don't cares" for the disallowed states results in very simple JK equations requiring no additional logic gates at all.

is there a way you can provide an example, but not give the answer...say in a 2 bit jk circuit counting from 2 to 1...skipping 3 and 0...or something similar.
 
  • #7
surfy14 said:
is there a way you can provide an example, but not give the answer...say in a 2 bit jk circuit counting from 2 to 1...skipping 3 and 0...or something similar.

Haven't you studied clocked state machines in your class? You have the general equation for the next state of a JK flip-flop$$
Q^+ = J\bar Q +\bar K Q$$so you can calculate ##J## by picking the 1's off the ##\bar Q## portion of the K-map and ##K## by picking the 0's off the ##Q## portion of the K-map of your next state equation for each bit. If you don't know what I'm talking about, you probably need more help than I can give you here.
 
  • #8
LCKurtz said:
Haven't you studied clocked state machines in your class? You have the general equation for the next state of a JK flip-flop$$
Q^+ = J\bar Q +\bar K Q$$so you can calculate ##J## by picking the 1's off the ##\bar Q## portion of the K-map and ##K## by picking the 0's off the ##Q## portion of the K-map of your next state equation for each bit. If you don't know what I'm talking about, you probably need more help than I can give you here.

What you suggest requires an explicit control of J and K inputs (and in general case it is a proper way) meaning that you need a complex logic in the front part. What surfy14 does is just using the time strobe. I think his task can be solved but can not be generalized to any output sequences. If you control J and K it is easy to obtain any sequence of numbers at the output with quite simple reorganization of the input control logic.
 
  • #9
LCKurtz said:
Haven't you studied clocked state machines in your class? You have the general equation for the next state of a JK flip-flop$$
Q^+ = J\bar Q +\bar K Q$$so you can calculate ##J## by picking the 1's off the ##\bar Q## portion of the K-map and ##K## by picking the 0's off the ##Q## portion of the K-map of your next state equation for each bit. If you don't know what I'm talking about, you probably need more help than I can give you here.

I made my transition table, k-maps, and equations, but not sure if they are right.

Here are my final next state equations derived from my k-maps

Q0 next state = Q0 NOT
Q1 next state = Q0
Q2 next state = Q1 NOT * Q0 + Q1 * Q0 NOT

Using Q+ = J QNOT + KNOT Q

J2 = Q1 NOT
K2 = Q1

I don't now how to calculate j0/k0/j1/k1 since their equations are not in the format of Q+ = J QNOT + KNOT Q. It is probably something easy that I'm not seeing...this is the first time I've attempted something like this so bear with me.
 
Last edited:
  • #10
surfy14 said:
I made my transition table, k-maps, and equations, but not sure if they are right.

Here are my final next state equations derived from my k-maps

Q0 next state = Q0 NOT
Q1 next state = Q0
Q2 next state = Q1 NOT * Q0 + Q1 * Q0 NOT

Using Q+ = J QNOT + KNOT Q

J2 = Q1 NOT
K2 = Q1

I don't now how to calculate j0/k0/j1/k1 since their equations are not in the format of Q+ = J QNOT + KNOT Q. It is probably something easy that I'm not seeing...this is the first time I've attempted something like this so bear with me.

OK, that's good progress. I agree that ##Q_0^+=\bar Q_0##. One way to figure out J and K is to notice from the next state equation for a JK flip flop ##Q^+=J\bar Q+\bar K Q## that ##J = Q^+|_{Q=0}## and ##\bar K = Q^+|_{Q=1}##. So in this case, where ##Q_0^+=\bar Q_0##, when ##Q_0=0## you get ##J_0=1## and when ##Q_0=1## you get ##\bar K_0 = 0##, so ##K_0 = 1##. That makes sense because, if you think about it, if you want a JK flip flop to toggle on every clock pulse, you want J and K to be 1.

Now, turning to ##Q_2##, the most significant bit, I agree again that ##Q_2^+=Q_0\bar Q_1+\bar Q_0Q_1##. You could do the same thing here, but it is better to go to the K-map, because you can use the don't cares. What you want to do to get ##J_2## is just look at the ##Q_2=0## part of the K-map and pick the 1's plus any good don't cares. To get ##K_2##, pick the 0's from the ##Q_2=1## part of the K-map, again using any useful don't cares. See what you get.

Finally, for ##Q_1##, check your tables and see if you don't get ##Q_1^+=\bar Q_0\bar Q_1+Q_0Q_1##. Then do either of the above techniques to get ##J_1## and ##K_1##.
 
Last edited:
  • #11
LCKurtz said:
OK, that's good progress. I agree that ##Q_0^+=\bar Q_0##. One way to figure out J and K is to notice from the next state equation for a JK flip flop ##Q^+=J\bar Q+\bar K Q## that ##J = Q^+|_{Q=0}## and ##\bar K = Q^+|_{Q=1}##. So in this case, where ##Q_0^+=\bar Q_0##, when ##Q_0=0## you get ##J_0=1## and when ##Q_0=1## you get ##\bar K_0 = 0##, so ##K_0 = 1##. That makes sense because, if you think about it, if you want a JK flip flop to toggle on every clock pulse, you want J and K to be 1.

Now, turning to ##Q_2##, the most significant bit, I agree again that ##Q_2^+=Q_0\bar Q_1+\bar Q_0Q_1##. You could do the same thing here, but it is better to go to the K-map, because you can use the don't cares. What you want to do to get ##J_2## is just look at the ##Q_2=0## part of the K-map and pick the 1's plus any good don't cares. To get ##K_2##, pick the 0's from the ##Q_2=1## part of the K-map, again using any useful don't cares. See what you get.

Finally, for ##Q_1##, check your tables and see if you don't get ##Q_1^+=\bar Q_0\bar Q_1+Q_0Q_1##. Then do either of the above techniques to get ##J_1## and ##K_1##.

thx for your help. close this thread.
 

Related to Create Mod Counter Using Flip Flops: 5 to 2 Cycle

1. What is a mod counter?

A mod counter, short for modulo counter, is a digital circuit that counts through a specific sequence of numbers and then repeats the sequence. It is commonly used in digital systems to keep track of the state or progress of a process.

2. How does a mod counter using flip flops work?

A mod counter using flip flops is made up of a series of flip flops, which are basic storage units that are used to store and manipulate binary data. The flip flops are connected in a way that creates a feedback loop, allowing the counter to count through a specific sequence of numbers before repeating.

3. What is the purpose of using a 5 to 2 cycle in a mod counter?

A 5 to 2 cycle in a mod counter means that the counter will count through 5 numbers before resetting back to 2 and starting over again. This allows for a more efficient use of the available counting range, as it can count through more numbers before repeating the sequence.

4. What are the advantages of using a mod counter?

One advantage of using a mod counter is its ability to keep track of the state or progress of a process in a digital system. It is also a more efficient and compact way of counting compared to using individual counters for each number in the sequence.

5. How can a mod counter using flip flops be implemented in a real-world application?

A mod counter using flip flops can be used in various real-world applications, such as in electronic devices that require tracking of time or counting of events. It can also be used in communication systems to keep track of the data being transmitted or received. Additionally, it can be used in industrial automation systems to monitor and control processes.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
20
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
Replies
10
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
5K
Back
Top