# Sequential circuit design

#### bellatrix

Joined Mar 27, 2018
11
I am trying to design a sequential circuit that starts with SO (00) and next state is 00 when input is 0. When input is 1, states go like 00--00--01--11--10
I dont know how to handle input=1 because next state can be 00 or 01 both. What can I do?

#### dl324

Joined Mar 30, 2015
15,436
What is SO? Is it a control signal? Post a complete state diagram or truth table.

#### bellatrix

Joined Mar 27, 2018
11
I meant state zero by SO

#### bellatrix

Joined Mar 27, 2018
11
What is SO? Is it a control signal? Post a complete state diagram or truth table.
S0 is state zero

#### dl324

Joined Mar 30, 2015
15,436

#### bellatrix

Joined Mar 27, 2018
11
Post a state diagram or truth table.
Present state input next state
--------------------- --------- -----------------
00 0 00
00 1 00
00 1 01*
01 1 11
11 1 10
10 1 00

* when present state is 00 and previous input is 0, next state is 00. When present state is 00 and previous input is 1 and the input is 1, next state is 01.

#### dl324

Joined Mar 30, 2015
15,436

It kind of looks like you want a circuit that counts when the input is 1, but the second line in the table is problematic. If the next state from 00 is 00, that conflicts with the next line that goes from 00 to 01.

#### djsfantasi

Joined Apr 11, 2010
8,652
Dl324 has nicely summarized the data. It’s a good table for the data as presented by the TS. But to resolve the problematic state, another piece of data is needed.

If the input is 1 and the previous state is 00, what is different in the data between the two next states 00 and 01?

The other piece of data is there. You just have to find it.

PS: my iPhone keeps autocorrecting TS to T-SHIRT! Annoying...

#### bellatrix

Joined Mar 27, 2018
11
View attachment 169136
It kind of looks like you want a circuit that counts when the input is 1, but the second line in the table is problematic. If the next state from 00 is 00, that conflicts with the next line that goes from 00 to 01.
Let present state 00 and input 1 and previous input 1. Then next state is 01.
Let present state 00 and input 1 and previous input 0. Then next state is 00.
I think I have to use a flip flop to hold previous input and current input for state changing.

#### WBahn

Joined Mar 31, 2012
27,857
I am trying to design a sequential circuit that starts with SO (00) and next state is 00 when input is 0. When input is 1, states go like 00--00--01--11--10
I dont know how to handle input=1 because next state can be 00 or 01 both. What can I do?
For a simple state machine (which is what it appears you are trying to create), the knowledge of what state you are in has to capture ALL relevant information about the ENTIRE history of the machine. So as soon as you say that, when in State 00 and the current input is 1, you do different things depending on what the prior input was, you have a situation in which just knowing that you are in State 00 is insufficient knowledge about the history of the machine to determine what to do next based on just the current input.

So you need to split the states. For instance, State 000 means that you are in State 00 and the prior input was a 0 while State 001 means that you are in State 00 and the prior input was a 1.

Joined Mar 10, 2018
4,057
On another subject, but related, if you wanted to play with a state machine you could
do this with one chip, leds and resistor off chip, and design a state machine to your
hearts delight. Tool is free, board is \$ 10. Shown is a 16 state state machine. You
edit the output pin states for the state number you want machine to go to on clock.
You can repeat states, make all independent states, or a mix. Lots of fun. Each press
of the switch/button is debounced and clocks the state machine to the next state you
programmed in the gui configurator.

Although this is a general purpose UP with lots of other capabilities, this example requires
no code writing. Its just a subset of the chips capabilities. You drag and drop the compo-
nents onto design canvas, wire them up, then double click them to config. Not too taxing.
A component is an onchip resource, design catalog shown to right of schematic. The
resources used show in far right window. In this case not much used to do this.

https://www.cypress.com/documentati...s/cy8ckit-043-psoc-4-m-series-prototyping-kit

This could have been more states, less states, cascaded state machines.... lots
of flexibility.

Could have used simple LCD display and some code to display states and give each state a name on display......
used A/D or counter or terminal or pot or sensor...... to control state input.....

By the way the state is indicated by LEDs in 4 bit binary. If I had not been lazy
I could have dragged a demux onto canvas and decoded the state, such that 16 LEDs
could have been used, each indicating what state the machine is in. Fun and games.
Or just use part of the demux to drive individual states. or use another state machine
to do the decoding.......

Regards, Dana.

Last edited: