# Design Sequential Circuit Counter (Earn $5) Thread Starter #### mitchmitch555 Joined Mar 2, 2015 5 Hello all, this is my first post on All About Circuits. I need some help understanding a project assigned in my computer architecture class. Successful help earns a$5 tip through paypal.

The problem description: Design a sequential circuit with three flip-flops and one input x. When x = 0, count 0, 2, 3, 5, 6 and repeat. When x = 1, count 6, 5, 3, 2, 0 and repeat.

My problem is that I don't know how to turn this information into boolean expressions for each flip flop, which I can then turn into state diagrams and tables. I know how to write an expression once I have the circuit drawn out in front of me, but I don't understand flip-flops and counters well enough to move through this problem. Some guidance would be greatly appreciated as this problem is due in class tomorrow morning.

#### tshuck

Joined Oct 18, 2012
3,534
You needn't offer money as incentive, most that would offer you help wouldn't be motivated any more by $5. Most of the regulars are here because they enjoy helping. To get a quality reply, all you need is a problem statement, your work (however complete/correct), a decent title, and a little bit of patience. Thread Starter #### mitchmitch555 Joined Mar 2, 2015 5 You needn't offer money as incentive, most that would offer you help wouldn't be motivated any more by$5.

Most of the regulars are here because they enjoy helping.

To get a quality reply, all you need is a problem statement, your work (however complete/correct), a decent title, and a little bit of patience.
I'm currently reading your Synchronous Counters article, tshuck. Extremely helpful. I now understand that I'm supposed to combine the three flip flops' outputs in order to get the "count" number, and that the output of a D flip flop is determined by the state of the D input at every positive edge of the clock update. However, I don't know how to control the output of a flip flop. To me it seems random based on the clock input. I don't understand the workings of the clock well enough to know what to do next so I can actually draw this circuit. My current "work" that I've completed is just converting the outputs I need to get from the flip flops to binary so I at least know what actual outputs I'm looking for.

#### tshuck

Joined Oct 18, 2012
3,534
I'm currently reading your Synchronous Counters article, tshuck. Extremely helpful. I now understand that I'm supposed to combine the three flip flops' outputs in order to get the "count" number, and that the output of a D flip flop is determined by the state of the D input at every positive edge of the clock update. However, I don't know how to control the output of a flip flop. To me it seems random based on the clock input. I don't understand the workings of the clock well enough to know what to do next so I can actually draw this circuit. My current "work" that I've completed is just converting the outputs I need to get from the flip flops to binary so I at least know what actual outputs I'm looking for.
I'm glad you found it useful. That article was intended to formalize what was already in the eBook for a basic synchronous counter. You have a little more complex circuit.

What you have is a finite state machine. Have you learned about them? If not, that's fine, this is a good bridge between counters and FSMs.

One major difference between the article and your design is that you have to have an input (x). To account for this, your state table must reflect the addition of the input.

This means that the part where we list the current state and next state, the input must be present. There are a few ways to do this, here's one:

You should have an extra column for the input, much like the following image from Georacer's article on Finite State Machines:
(disregard the output column)

Note on the image: The current state would be the two bits A and B, where I have listed them as their binary count value in the following table.

Then fill in the table for your design:
Current State | Input (x) | Next State
000|0|010 = 2
000|1|110 = 6
001|0|xxx = not valid state
001|1|xxx = not a valid state
010|0|011 = 3
010|1|000 = 0
...|...|...
This table captures the behavior of the counter, including the behavior as a result of x. Notice that a current count of 0 is listed twice - once when x=0 and again for when x=1.

Try to fill in the table on your own, here's the code for the table:
Code:
[Table=head] Current State | Input (x) | Next State
000|0|010 = 2
000|1|110 = 6
001|0|xxx = not valid state
001|1|xxx = not a valid state
010|0|011 = 3
010|1|000 = 0
...|...|...
[/table]
_____________________________
Another way to do this might be to count up and down 0-4 and map the count value to the appropriate output, e.g.:
Count => Mapped Output
0 => 0
1 => 2
2 => 3
3 => 5
4 => 6
Then you only have to worry about a mod-5 up/down counter.

Last edited: