# How to start a binary ripple counter from the middle?

1. Dec 13, 2012

### rasen58

I needed to make a ripple counter start from 3 and end at 17. I got it to reset to 0 when it reaches 17, but I can't get it to start from 3.
I am using 5 JK latches with LEDS attached to the outputs of each to represent each number.
To get it to stop at 17, I nanded the msb and lsb and connected it to the active low resets on the latches.
To start them at 3, I tried ORing the 3 msbs, and ORing the output of that to the 2 lsbs anded
3 = 00011, so if the msbs are all 0 and the 2 lsbs aren't 11, then it should output a 0. This works, but it also causes a problem, because now the reset is always low and it can never become a 1.

2. Dec 13, 2012

### justsomeguy

Can I ask to what purpose you need to start and stop in these arbitrary positions? The more routine way to approach a problem like this is to let the counter run normally but treat the output differently.

3. Dec 13, 2012

### rasen58

Oh, my teacher just asked us to try it

4. Dec 13, 2012

### justsomeguy

Ahh, I see. Well, JK latches all start with both of their outputs low as far as I know, so that should tell you what you need to do to have the two you want start off high instead. Then you need to see what happens the first time each one toggles, which will lead you to another change you'll need to make. You do not need to tie any other gates to the first two.

Edit : I thought about this a minute longer and the initial thought I had isn't going to work. Not sure that it's possible now that I think about it more.

Last edited: Dec 13, 2012
5. Dec 14, 2012

### aralbrec

Sometimes JKs have presets and resets. If not, there's always another way to reset or set a flip flop state. Your global reset signal should be another way, in addition to counter rollover, to start at 3.

6. Dec 14, 2012

### aralbrec

Through J and K. I didn't seem to finish my sentences in a few posts :)

7. Dec 14, 2012

### rasen58

How else would you reset a flip flop without an actual reset pin?

8. Dec 15, 2012

### Staff: Mentor

I haven't looked at this, but what happens if you take as your output ¬Q where you want a 1 in that position?

9. Dec 15, 2012

### aralbrec

When J=0 and K=1, the flip flop is reset on the next edge.
When J=1 and K=0, the flip flop is set on the next edge.

But I was not thinking of a ripple counter, sorry.

Instead of placing logic at the input, you can place logic at the output. One way is to count from 0 to 14 and add 3 with external logic. That would take a lot of gates and is not a good way to go.

Another idea which might be a winner is to change the bit values coming out of the two least significant bits. The two least significant bits count 00,01,10,11 but you want them to count 11,00,01,10. Can you add some logic at the output of those two smallest flip flops to make the translation?

Last edited: Dec 15, 2012