0
\$\begingroup\$

I'm aware of designing synchronous counter design for a counting sequence where I write the state table with present and next state and then followed by flip flop inputs (filled using the excitation table of the corresponding flip flop). But how to design if the states are repeating I'm not aware on how to proceed further and hence needed help.how to design a synchronous counter for a repeating counting sequence. I have listed an example .enter image description here

\$\endgroup\$
  • \$\begingroup\$ Count up normally to the number of steps you want using a regular counter and then use another circuit to convert the count value to the output you want. Or if you were doing this with real chips instead of just gates feed the output of the counter to a ROM lookup table to output the values you want. \$\endgroup\$ – slebetman Mar 10 '17 at 17:07
  • \$\begingroup\$ Could you please explain? \$\endgroup\$ – Fawaz Mar 10 '17 at 17:13
  • \$\begingroup\$ I thought of FSM as well but then that would need extra inputs which is not allowed in counters. \$\endgroup\$ – Fawaz Mar 10 '17 at 17:14
  • \$\begingroup\$ Sorry 3, You are actually counting a sequence of 8 states. So you need 3 bits... = 3 flip-flops. The values 0,1,2 and 3 are taken from the 2nd and 3rd bit of the counter. You ignore the first "bit". \$\endgroup\$ – Trevor_G Mar 10 '17 at 17:15
  • \$\begingroup\$ But then what if the counting sequence is something like 0-1-0-2-0-3? \$\endgroup\$ – Fawaz Mar 10 '17 at 17:19
1
\$\begingroup\$

The answer is 3.

You are actually counting a sequence of 8 states. So you need 3 bits... = 3 flip-flops.

The values 0,1,2 and 3 are taken from the 2nd and 3rd bit of the counter. You ignore the first "bit".

Or if you prefer, you can refer to the first stage as a clock divider "/2" for your two bit counter.

State machines can be simple or can get to be extremely complicated looping, input dependant beasts what give engineers nightmares.

In your simple examples you are actually asking for two different things.

First, to sequence through a pattern of N numbers then repeat. For that you need to count where you are in the sequence using your counter up to N. When N is reached you need logic to reset the counter.

Second you need logic to OUTPUT the appropriate value at each count.

If the latter is extremely complex or likely to change upon development and experimentation, it is usually done by feeding the count as an address into an E-Prom which is programmed to give out the right value on its data pins according to the counter value.

One of said data pins can be used to reset the counter so you can have a different N value, some can be used to feed back on itself as more address pins to switch pages.

As I say, it can get intricately complicated.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ What I was looking for is a generalised method. What if the counting sequence is 0-1-0-2-0-3? \$\endgroup\$ – Fawaz Mar 10 '17 at 17:20
  • \$\begingroup\$ Then you would need some form of reset or pre-setting logic that sets the load condition state based on the current state. Without a micro the simplest way to do that is with an e-prom. \$\endgroup\$ – Trevor_G Mar 10 '17 at 17:22
  • 1
    \$\begingroup\$ @Fawaz, if it has the same outputs but different next state (and no distinction on inputs) then you have to treat it as a different state. So your new example has 6 states. \$\endgroup\$ – The Photon Mar 10 '17 at 17:22
  • \$\begingroup\$ It really depends on the sequence though. It does not need to get very complicated before you are better off using a programmable device. \$\endgroup\$ – Trevor_G Mar 10 '17 at 17:24
  • 1
    \$\begingroup\$ @Fawaz, a counter is a kind of FSM. \$\endgroup\$ – The Photon Mar 10 '17 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.