# 0=>1=>0=>3 counter design

Status
Not open for further replies.

#### phoibos

##### New Member
can someone create the state diagram or state table for this counter design. I worked on it but I couldn't solve the problem. When the first state is 0 which way the counter will count to 1 or to 3 ? Thanks.

#### dknguyen

##### Well-Known Member
-Remember, the name or label of a state diagram is NOT the output of the state diagram. Just because a state is named "one" does not mean it has to output a "one". It doesn't even have to be the first state. It's like a state being named "Dog" does not have to output a dog in the same way. And there is no such thing as the number dog as far as the order of the state.

-Different states can output the SAME output. What makes a state unique is it's output and the other states your current state can send you to. So if two states have the same output, have different next states, then they cannot be combined to the same state.

For example:
STATE NAME - OUTPUT
one - 0
two - 1
three - 0
four - 3

The state named 1 doesn't have to output a 1- that's just it's name. You might want to rename the state label so it starts from zero:
zero - 0
one - 1
two - 0
three - 3

Or you could jsut rename the states alphabetically:
A - 0
B - 1
C - 0
D - 3

If I wanted to, I could name the states in reverse order:
Four - 0
Three - 1
Two - 0
One - 3

My preference is to name a state after what it does rather than an order because in state machines were states can branch, the states don't really have an order anymore since any state can jump to any other state.

Output First Zero - 0
Output One - 1
Output Second Zero - 0
Output Three - 3

Last edited:

#### phoibos

##### New Member
It's forbidden to use inputs or outputs for that question unfortunately. Do you have any other ideas?

#### dknguyen

##### Well-Known Member
When the first state is 0 which way the counter will count to 1 or to 3 ?
Multiple states can have the same output. THe same output is not enough to make a state unique. The things that make a state unique are the output AND how you reach that state and where that state can send you to. You have two states that output zero, but one state continues to the state that outputs 1, and the other state continues to a state that outputs 3. Therefore you have to unique states that output zero.

It's forbidden to use inputs or outputs for that question unfortunately. Do you have any other ideas?
Counters have outputs. If you built a counter from states that output nothing you have no outputs so you have no counter. Plus the counter has to accept some input to know when to count, like a clock input.

I think you are misinterpreting something in the question.

Last edited:

#### phoibos

##### New Member
I mean the inputs which are entered by user like in an elevator system. Sorry for misexplaining.

#### dknguyen

##### Well-Known Member
An input does not have to come from a user. It just has to come from something external to the state machine. You need an input to a state machine or else the machien would never change states. For example, a state machine that only has a 1Hz clock input might make the state machine continue to the next state every 1 second. If you had more inputs it might make a state A branch and go to either state B or all the way to state Q depending on what the input was when you are in that state. They don't have to come from a human user with buttons. It can come from anything that sits outside the state machine.

Look at this state machine for example:
FileFAexample.svg - Wikipedia, the free encyclopedia

S1 and S2 output something, we don't know exactly what it outputs but it's something. They could output anything, even the same thing. The labels above the arrows are telling us what state is the next state depending on the input. In this diagram there is only one input that can be either 0 or 1, so each state can only jump to two other states. If there were more inputs then each state would be able to jump to more than just two other states. From this diagram, when the input is 0, the state jumps to the other state (the other state is the next state), but when the input is 1 then the state jumps to itself (the next state is itself) so it actually stays the same.

This input could be a momentary pushbutton that normally sends a 1 to the state machine, but when pressed down it sends a 0 to send go to the next state. Or this input could be a clock signal that keeps going 0 and 1 repeatedly, then the state would jump to the other state and wait a bit (jump onto itself over and over again as long as the input is 1), and then jump to the other state again).

Last edited:

#### phoibos

##### New Member

The problem is when the current state is 00 in according to this diagram which way will be active, 00-01 or 00-11 how can I define that in the state diagram?

#### dknguyen

##### Well-Known Member
Have you been reading my posts? THe state's name is unrelated to the state output. Your confusion arises from the fact that you are naming your states based on their output when the two are completely unrelated. You can have two states that output zero.

You have two states that have the same output but they are still different states because they have different next states. The first state tht outputs a zero has a next state that outputs 1. The second state that outputs 0 has a next state that outputs 3. Therefore these are two unique states that cannot be simplified into a single state, even if they have the same output.

Look at my state diagram. Are the top diagrams and the bottom diagrams any different? Both diagrams are identical, except in the top diagram I gave the states unique names and in the bottom one I didn't name them. Just because I did not name them and the first and third state in the bottom diagram have the same output does not mean that the two states are the same.

In the top diagram State A and state C are two separate states even if they have the same output. State A outputs 8 but goes to state B. State C also outputs 8 but goes to State D. So State A and C are not equivelant. The two states have the same output, but they are not the same state because they have different next states. This is why you should give your states a name that is separate than the output. You should not name your state after it's output because different states can have the same output.

Did you notice how I have more states than you do? Your problem can only be solved with 4 states, and you are trying to do it with 3 because you keep thinking that the first "0" and the second "0" are the same state just because they have the same output.

#### Attachments

• State Machine.pdf
5.8 KB · Views: 90
Last edited:
Status
Not open for further replies.

Replies
1
Views
2K
Replies
3
Views
1K
Replies
1
Views
4K
hyedenny
H
Replies
2
Views
1K
Replies
9
Views
1K