Suppose we want to have this sequence 30, 50, 1003, 30, etc... It's no hard to see that we need a MOD-3 counter because there're only 3 states. But this also means we need 2 flip flops. But how do we represent 30 or 50 in the output? What is the design of such counter? Do we have to use a decoder to map 0 -> 30; 1 -> 50 and 2 -> 1003?

I'm new to electronics so my question might be quite silly but this seems so confusing to me. If I have to design a counter that results in another sequence like: 000, 001, 101, 000,... then it's three flip flop matching with three bits of our output (Q2, Q1, Q0 and D2, D1, D0 would be function of Q2, Q1, Q0 if we're using D flip flop and designing synchronous counter). Again, this is MOD-3 counter which only requires 2 flip flops!?

How can such circuit be designed? Thank you in advance! :D

  • \$\begingroup\$ There are many devices to choose from: TFF, DFF, JKFF. The power up state can be adjusted too depending on the specific implementations. And these usually have both Q and not Q outputs, but not always. A general procedure takes a lot of words, plus multiple concrete examples, to illustrate. Too much to write here. But this isn't hard. It will just take some work on your part. Going to sleep now. But I'll reference many examples I've already produced here when I wake up. \$\endgroup\$
    – jonk
    Commented May 30, 2022 at 8:48
  • \$\begingroup\$ For example, though, see this. \$\endgroup\$
    – jonk
    Commented May 30, 2022 at 8:59
  • 1
    \$\begingroup\$ "But how come do we represent 30 or 50 in the output?" - how do you want to represent it? \$\endgroup\$ Commented May 30, 2022 at 9:06
  • 3
    \$\begingroup\$ You use a lookup table (essentially a small ROM) to map the 2-bit state value to any number of bits for the output value. Nobody ever said that the state bits always have to be used directly as the output bits. \$\endgroup\$
    – Dave Tweed
    Commented May 30, 2022 at 9:47
  • \$\begingroup\$ you could have two output wires and attach a sticky note saying low/low means 30, low/high means 50 and high/low means 1003 \$\endgroup\$ Commented May 30, 2022 at 10:05

1 Answer 1


If you have a binary flip flop, its stable output is high voltage, or low voltage, so it can be in one of two states.

It is up to you whether you call those two states (0,1), (True, False), (30, 50). Depending on what you are trying to do, some codings may be more useful than others.

With two flip flops, you can now uniquely encode four states. Again it's your choice to call them what you want, and to not use all of them.

If you have a black box which can output a two bit binary signal to encode its four states, but you have a large number of lines you want driven, then the simplest way to design something that can do that is to use a decoder-encoder model. The decoder drives one line for each state that can be output (using perhaps half an HC139). The encoder takes each output and uses it to drive a number of lines to represent 30, 50 or 1003 in the encoding of your choice, whether it's binary, BCD, one-hot, 7-segment or anything else.

There may be more efficient ways to do this encoding, especially if you have a large number of states, or there is some regularity in the choice of final output representations that can be exploited, usually discovered by constructing a Kernaugh map from input to output.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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