# Constructing a MOD-13 counter using JK flip-flops and logic gate(s)?

#### yazarmyint

Joined Dec 13, 2019
1
I have this question on one of my assignments and I was under the impression that all I needed for the MOD-13 counter was 4 flip flops. The "and logic gate(s)" part is throwing me off. Also the second part is "What does the MOD indicated? Wouldnt that just be 12 since it goes 0-12?

#### Papabravo

Joined Feb 24, 2006
14,876
I have this question on one of my assignments and I was under the impression that all I needed for the MOD-13 counter was 4 flip flops. The "and logic gate(s)" part is throwing me off. Also the second part is "What does the MOD indicated? Wouldnt that just be 12 since it goes 0-12?
No, not necessarily. A MOD-13 counter has 13 states, but they don't have to be 0-12, they can be ANY convenient subset of the 16 possible states that are available in a 4 bit counter.
The "and logic gate(s)" part of the assignment refers to the need to decode the terminal state of the sequence so the initial value can be loaded into the counter before the next clock. If the design is to be really complete there will also be decoding and recovery from the counter getting into an illegal state, of which there will be three.

Suppose for example that your 13 states will be 0b0011 to 0b1111. So 3 will be your initial state and 15 will be the terminal state and states {0, 1,2} will all be illegal. You can of course investigate the other 14 ways of doing it to see if any of them have an advantage.

Because JK flip-flops have 4 things they can do {SET, CLEAR, HOLD, and TOGGLE} you have to make sure that in each state, each of the four flip-flops will do the right thing (ie have J and K set correctly prior to the next clock edge). For example if the 4 flip-flops are labeled {D, C, B, A} then to load the value 3 you would set D.JK = CLEAR, C.JK = CLEAR, B.JK = SET, A.JK = SET and at the next clock edge the right value gets loaded.

Last edited:

#### SteveSh

Joined Nov 5, 2019
105
No, not necessarily. A MOD-13 counter has 12 states, but they don't have to be 0-12, they can be ANY convenient subset of the 16 possible states that are available in a 4 bit counter.
A mod 13 counter has 13 states, not 12. A count sequence of 0->12->0 cycles through 13 states.

#### Papabravo

Joined Feb 24, 2006
14,876
A mod 13 counter has 13 states, not 12. A count sequence of 0->12->0 cycles through 13 states.
You are correct. There was a typo in the reply but the example of counting from 3 to 15 has the required 13 states.

#### dl324

Joined Mar 30, 2015
12,265
Also the second part is "What does the MOD indicated? Wouldnt that just be 12 since it goes 0-12?
It depends. Normally I'd think of a MOD 13 counter as counting from 0-12, but it could also be 1-13, or some other sequence that has 13 states.