# Counter Scoreboard using JK flip flop connecting to a 7 segment (breadboard)

#### WBahn

Joined Mar 31, 2012
26,398
I didn't quite understand but i want it also to do (2^n)-1 for example if it was 1 and the user presser SW 2 it will increment by 2 it will become 3...
If you use (2^n)-1 then you don't have any way to count by 2. n=0 => 0, n=1 -> 1, n=2 => 3.

You want 2^n where n is the number of the FF that you increment (toggle) starting with n=0 is the lsb. If n=0 then you toggle the lsb and that forces the counter to count by 2^0=1. If you have n=1 then you toggle the FF next to the lsb and that forces the counter to count by 2^1=2. If you were to use n=2 and toggle the next FF up that would force the counter to count by 2^2=4, but you aren't interested in that case.

#### WBahn

Joined Mar 31, 2012
26,398
i'm using six flipflops because from my calculation above 3 flipflops to increment by 1 and the other 3 to increment by 2 but i don't if this the right way that's why i'm asking you... P.S: That's my first time using JK flip flop (7476) that's why i'm having trouble how to connect them...
If you use three FF to count by 1 and three other FF to count by 2, how are you going to keep them synchronized and how are you going to choose which ones drive the display?

You need a single counter whose control logic makes it increment by one when one input is received and increment by two when a different input is received.

If you are unfamiliar with JK flip flops, then perhaps you best spend some time learning about JK flip flops, how they behave, and what their inputs do before attempting to design a circuit using them.

#### AnalogKid

Joined Aug 1, 2013
9,621
i'm using six flipflops because from my calculation above 3 flipflops to increment by 1 and the other 3 to increment by 2 but i don't if this the right way that's why i'm asking you...
Generally speaking, if you have a multi-bit counter and the outputs have to do different things under different conditions, it is better to have one set of outputs and do whatever it takes to control the counter inputs, rather than have two counters and somehow combine their outputs correctly for the different conditions. In your case, it is better to have one 3-bit counter and figure out how to get it to increment by one sometimes and by two other times. If you google 'ripple counter' and 'synchronous counter' and look at a few (dozen) schematics, you should see the basics of how flipflops are connected for each type.

ak

#### sailorjoe

Joined Jun 4, 2013
363
Xcmvys, all your responses indicate that you don't yet understand how to build a binary counter. So here are some basics to get you started on the right foot.
A. The number of flip-flops you need is equal to the number of bits in binary you want to count. Can you answer this question: which one of the flip flops is the least significant bit?
B. The output of one flip-flop can be the clock for the next flip-flop. Or all the clocks of all the flip flops can be tied together. Question: which of these methods is called a ripple counter?
If you can answer these questions, we can move on to more advanced questions.

#### xCMvYs

Joined Jan 4, 2016
11
Just finished the project thanks for your help

#### hp1729

Joined Nov 23, 2015
2,304
hello,
i'm new here and this is my first thread
so i have this project hope you can help with it! thank you in advance.

Project:
2 switches (normally the switch is open.)
if the user presses on switch one the 7 segment will be incremented by 1
if the user presses on switch two the 7 segment will be incremented by 2
so if the result on the seven segment display was 3 and the user presses on switch nb 2, the result will be 5.
when it reaches 7 it will restart from 0

I am using 6 JK flip flop as the teacher recommended (3 for switch 1 and 3 for switch 2 since we're dealing with 3 bits max 000->111)
i found the equaions for JA, JB, JC and KA, KB, KC but i don't know if it's that way to find it. I considered X (switch 1) and Y (switch 2)... Is it correct? (calculation in the image below)
View attachment 97797 View attachment 97798
If my calculations are correct how should I connect the circuit and the 7 segment or do I need to do more calculations or need more components such as resistors, regulator...

Thank you again!!
if your teacher suggested six J-K flip flops this is not what she had in mind, but it almost works. Yes, it increments by 1 or 2 and goes from 3 ton 5 as desired, but ... Resets at 7, has a manual reset, and does not go from 7 to 1 if 2 is added.
6 flip flops? Maybe she is suggesting two 3-bit counters that are added together?

#### Attachments

• 10.7 KB Views: 63

#### xCMvYs

Joined Jan 4, 2016
11
if your teacher suggested six J-K flip flops this is not what she had in mind, but it almost works. Yes, it increments by 1 or 2 and goes from 3 ton 5 as desired, but ... Resets at 7, has a manual reset, and does not go from 7 to 1 if 2 is added.
6 flip flops? Maybe she is suggesting two 3-bit counters that are added together?
Thank you! I did it in a similar way without resistors and capacitance!

#### AnalogKid

Joined Aug 1, 2013
9,621
Design 556 -

Don't think you need gate U4A because the counter naturally rolls over at "111". Also, SW3 applies a dead short to GND its output. Finally, I'm not sure that summing Cap4 and Cap5 into U1Bpin6 is going to produce reliable results. Have you built a circuit where this worked?

ak

Last edited:

#### AnalogKid

Joined Aug 1, 2013
9,621
Here is an alternate design.

ak

#### Attachments

• 10.9 KB Views: 24

#### WBahn

Joined Mar 31, 2012
26,398
i tried it not working..guys i need help
Then you need to show YOUR attempt to work the problem.

Think about it -- try calling up an auto mechanic and telling them that your car isn't working and then expecting them to tell you want is wrong with it.

At the very least, give us a decent hint as to HOW it is not working.

#### Thinesh Ravenda

Joined Nov 15, 2016
3

sori i am new to this forum and i dont know how to ask help...sori again....it seems no output from 7 segment and the output from the bcd is decreasing from 7....what mistake i did and should i repaired ...still new in flip flop...sori again and thanks in advance

#### Attachments

• 32.2 KB Views: 9
• 32.2 KB Views: 12

#### WBahn

Joined Mar 31, 2012
26,398
You've got an unconnected input pin on the 7447. How does that part behave when that pin is unconnected?

You are using gated clocks. The simulator might be okay with this, but the real world isn't nearly as forgiving, particularly when switches are involved. You can expect switch bounce and glitch signals that will make your circuit behavior completely unpredictable.

Saying that it is running backward doesn't give enough information because you've got this switch, S2, that is involved in this. So what is the state of S2?

Make a timing diagram and walk through it event by event to see what is going on -- that will also help you get proficient at how flip flops work and how to work with them.