# State table for a single traffic light using JK-flip flops

#### Yoshio

Joined Mar 9, 2016
4
Hey guys, I'm working on a simple project where we have to use JK-flip flops for a single traffic light, that goes from:
Green-Yellow-Red-Red+Yellow...and repeats.
We have been given a guide-line where we have to fill out 6 karnaughdiagrams. The thing I dont understand is how am I supposed to use an 8 states for a single traffic light, I wrote up a 4 state table, where I put in 1 in the lights that are supposed to light up, but apparantly I need to use 8 states. Do I just repeat the 4 first states?

States - Q2Q1Q0 - R Y G
0 --- 0 0 0 --- 0 0 1
1 --- 0 0 1 --- 0 1 0
2 --- 0 1 0 --- 1 0 0
3 --- 0 1 1 --- 1 1 0

Am I completely out in the forest with this logic?
Thanks for the help.

#### WBahn

Joined Mar 31, 2012
30,250
Are the 6 k-maps you are referring to the maps for the J and K inputs to the JKFFs?

If so, how many JKFFs does that imply?

Where are you getting the "8 states" requirement from?

#### Yoshio

Joined Mar 9, 2016
4
The 6 k-maps are for the J and K inputs yes. I will link a picture of them, the 1-00 are filled in for us to help.
I think I'm having a breakthrough though, they gave us a tips for one of the states. I will link it aswell.
Here is my thinking so far.

#### Attachments

• 18 KB Views: 44
• 4.4 KB Views: 52
• 150.9 KB Views: 50

#### WBahn

Joined Mar 31, 2012
30,250
My guess is that they are leading you to a solution where the output of each JKFF exactly matches the on/off state of one of the LEDs.

#### Yoshio

Joined Mar 9, 2016
4
What role does the present state play, like I just wrote up all the different possibilities in the present state table, and then put in the color changing in the new state table...I'll try googling a little about it.

#### WBahn

Joined Mar 31, 2012
30,250
Which lights are on is completely dependent on the present state. If you are in state X the only the brown light is on, while if you are in state Y both the blue and the orange lights are on.

#### Yoshio

Joined Mar 9, 2016
4
Hmm, alright. So if I assign the green light to q0, yellow to q1, and red to q2. Then the first state where the green light is supposed to be on would be:
q2q1q0
0 0 1
right? What do I put in the new state then, the color that comes after green, or?

#### WBahn

Joined Mar 31, 2012
30,250
Hmm, alright. So if I assign the green light to q0, yellow to q1, and red to q2. Then the first state where the green light is supposed to be on would be:
q2q1q0
0 0 1
right? What do I put in the new state then, the color that comes after green, or?
Well, ask yourself what state it needs to go to after the state in which the green light is on. The color that comes after green (i.e., the state in which only the yellow light is one) would seem to fit the bill.