4 bit sequncial counter

Thread Starter

ddadan

Joined Feb 8, 2017
9
How to design sequencial counter with sequence 13-6-8-11-13- ... if the input k = 0,
and 13-11-8-6-13 -...if the input k = 1, by using T flip flop.

Please help...
 

WBahn

Joined Mar 31, 2012
30,077
The first step is usually to either draw a state diagram or a transition table (the transition table is often easier to do if you have a state diagram, but in this case you really don't need one).

The next step is to determine how many states you need.
 

Thread Starter

ddadan

Joined Feb 8, 2017
9
Yeah, homework.
In my trasition table did i need to present all numbers from 0 to 15 or just my sequence.
Can you explain transition table or state diagram, i know how to draw counter.
 

dl324

Joined Mar 30, 2015
16,943
In my trasition table did i need to present all numbers from 0 to 15 or just my sequence.
All numbers. The ones not in your sequence will be don't cares which can simplify the logic.

You should have been taught how to make the transition table, which may have been called a truth table. We'll try to guide you, but we're not supposed to do the work for you.
 

WBahn

Joined Mar 31, 2012
30,077
Take a moment and consider how many states you need. How many states are in your diagram? How many flip flops do you need for that many states?

What if I asked you to design a counter that goes from A to B to C to D and back to A. How many states would you say were needed?
 

WBahn

Joined Mar 31, 2012
30,077
4
In first guestion i ask if i need truth table from 0 to 15, or just my sequnce.
Yes, you only need four states and it only has to be a bi-directional counter (which you said you know how to make). It's generally worthwhile to find ways to turn something you need to do into something you already know how to do. Which is not to say that such a solution is always the best solution -- but it's worth considering. So it might be worth giving some thought about how you might take a two-bit output and produce the specific four four-bit output values you need.
 

Thread Starter

ddadan

Joined Feb 8, 2017
9
Yes, you only need four states and it only has to be a bi-directional counter (which you said you know how to make). It's generally worthwhile to find ways to turn something you need to do into something you already know how to do. Which is not to say that such a solution is always the best solution -- but it's worth considering. So it might be worth giving some thought about how you might take a two-bit output and produce the specific four four-bit output values you need.

This is how i understand you.
Now i just need to represent my flip flop state
This is little easier example.
 

WBahn

Joined Mar 31, 2012
30,077
That diagram only show it counting in one direction -- you said you needed it to go in both directions. With four states, you only need two flip flops -- which also has the nice trait of leaving you without any unused states. In homework, "don't cares" may be "don't cares", but in the real world, you need to carefully consider the behavior of each unused state in light of what behavior is at least tolerable should the system end up in one of those states.
 

WBahn

Joined Mar 31, 2012
30,077
How two flip flops, we have state with four bits.
Uh... Both are LO, The first is LO and the second is HI, the first is HI and the second is LO, Both are HI.

You said you knew how to implement counters. How would you implement a simple, vanilla, mod-4 counter that counts through states (0, 1, 2, 3) and then repeats? How many flip flops would you need?
 

WBahn

Joined Mar 31, 2012
30,077
I'm talking about first example, not about this.
What is different about a counter that goes (0, 1, 2, 3), one that goes (13, 6, 8, 11), one that goes (H, R, O, Q), and one that goes (Bob, Sue, Tom, Jenny)?

In each case you need four states.

Since a state-machine constructed of N 2-state devices can represented 2^N states and since 4=2^2, you can do it with as few as two flip flops.
 

RBR1317

Joined Nov 13, 2010
714
In each case you need four states.
Suppose one needed a 4-color state machine (blue, red, yellow, green) but it was easier to design a state machine with various shades of pink. Then one could just say that pink represents blue, dark pink = red, light pink = yellow, & pale pink = green. But what if the requirement is to see the actual colors? Then one could feed the pink shades into a color changer to get the proper blue, red, yellow, and green colors. Or one could design a state machine capable of producing a broad range of colors, but limit it to selecting only the blue, red, yellow, and green colors (and all the other possible colors would be don't-care colors).
 

WBahn

Joined Mar 31, 2012
30,077
Suppose one needed a 4-color state machine (blue, red, yellow, green) but it was easier to design a state machine with various shades of pink. Then one could just say that pink represents blue, dark pink = red, light pink = yellow, & pale pink = green. But what if the requirement is to see the actual colors? Then one could feed the pink shades into a color changer to get the proper blue, red, yellow, and green colors. Or one could design a state machine capable of producing a broad range of colors, but limit it to selecting only the blue, red, yellow, and green colors (and all the other possible colors would be don't-care colors).
That's covered by Post #10. The TS was going down a rabbit hole (albeit one that would lead to a valid solution) by assigning the number of states based on the value the state represents instead of the number of values that need to be represented. Taking your last example (which is basically the same thing), if we use 24-bit colors, then that approach would require 24 flip flops to implement a four-state machine. Valid, but way too expensive on a number of fronts and also fraught with issues that have to be carefully addressed, such as trap states. Very seldom are unused states truly "don't cares" -- the term "don't care" would literally encompass anything, from the machine stalling in a whatever state it ended up in because of a stray cosmic ray upsetting one of the flip-flops to wandering endlessly in a seemingly random walk through the state space, to starting a global thermonuclear war; all of these are equally valid outcomes if we truly don't care.
 
Top