# state transition diagram for jk flip flops

#### dnguyen5

Joined Apr 24, 2008
2
I'm having difficulty with this problem.

using a synchronous controller with jk flip flops, a device is to turn whenever it hits an object. on the front of the device, there is a sensor whose output is "1" whenever it hits an object and "0" in any other case. It has two control lines; turn left and turn right until no object is in the way. when device hits an object it should turn right until no object is in the way. The next time it hits an object, it should turn left until it is clear of the object and repeats.

Can anyone help me with state transition diagram or how to setup the problem?

#### dnguyen5

Joined Apr 24, 2008
2
The state diagram must also be a Mealy state diagram.

Everytime i set up the problem my states don't go through the proper states and it ends up going right...then right and left depending on the input

#### Caveman

Joined Apr 15, 2008
471
You have 3 output states: Straight, Left, Right. But to make it easier, you should actually use 4 states: Straight1, Left, Straight2, Right.

Rich (BB code):
Current State     Sensor Input    Next State
Straight1              0           Straight1
Straight1              1           Left
Left                   1           Left
Left                   0           Straight2
Straight2              0           Straight2
Straight2              1           Right
Right                  1           Right
Right                  0           Straight1
Does that help?