State diagram design

Thread Starter

rt694157

Joined Dec 15, 2019
78
Hi, I have been visited on page https://en.wikipedia.org/wiki/State_diagram there is description for sate diagram I want to learn to make state diagram but I do no understand how to get started,

I have started with LED and SWITCH example ,
  1. When switch is ON , LED should be ON
  2. When Switch is OFF, LED should be OFF

1588358388369.png
Is it a state diagram where output shown in circle where output shown via arrow ?
 

Papabravo

Joined Feb 24, 2006
21,094
Hi, I have been visited on page https://en.wikipedia.org/wiki/State_diagram there is description for sate diagram I want to learn to make state diagram but I do no understand how to get started,

I have started with LED and SWITCH example ,
  1. When switch is ON , LED should be ON
  2. When Switch is OFF, LED should be OFF

View attachment 205911
Is it a state diagram where output shown in circle where output shown via arrow ?
I interpret this state machine to be one where the output (condition of the LED) is only a function of the states. The arcs are labeled with the input conditions. It might be instructive to add arcs that loop back on the states as long as the input remains in the specified condition. The idea being that the input is "sampled" at discrete time intervals. Once a change is detected, a state change is required, and the next state change can only happen at the next sampling interval.

In other words, the machine may not be able to track very rapid changes in the state of the switch.
 

Thread Starter

rt694157

Joined Dec 15, 2019
78
I interpret this state machine to be one where the output (condition of the LED) is only a function of the states. The arcs are labeled with the input conditions. It might be instructive to add arcs that loop back on the states as long as the input remains in the specified condition. The idea being that the input is "sampled" at discrete time intervals. Once a change is detected, a state change is required, and the next state change can only happen at the next sampling interval.

In other words, the machine may not be able to track very rapid changes in the state of the switch.
When you work on a project, do you draw or drawn a state diagram? If you draw a state diagram, what software do you use for it? please recommend anyone

it is not good to demand something, but can you create a state diagram for switches and LEDs?

I think my diagram is a state diagram as per my best, if you can show your state diagram then I can see the difference between diagram in yours and mine and I will have idea. This is not an assignment, I chose an simple example to draw flow chart
 

Papabravo

Joined Feb 24, 2006
21,094
When you work on a project, do you draw or drawn a state diagram? If you draw a state diagram, what software do you use for it? please recommend anyone

it is not good to demand something, but can you create a state diagram for switches and LEDs?

I think my diagram is a state diagram as per my best, if you can show your state diagram then I can see the difference between diagram in yours and mine and I will have idea. This is not an assignment, I chose an simple example to draw flow chart
I don't usually make a diagram because the number of states and arcs makes the diagram cluttered. I do make a state transition table. On the left are the present states and present inputs, On the right are the next state, and present outputs. These are called Moore machines. I might make a drawing of a subset of the entire diagram with a pencil and a drafting template. Sorry -- I'm old school.

StateMachine.png
 
Last edited:

402DF855

Joined Feb 9, 2013
271
When you work on a project, do you draw or drawn a state diagram? If you draw a state diagram, what software do you use for it?
Only for more complicated applications. I wrote a C++ parser years ago; it has 500 "states" and about 110 inputs (tokens). I have a 30 page diagram for the syntax logic. I'm too lazy to use SW for diagrams. Pencil and paper; I scan it if I want it for documentation.

I think a useful exercise for a student would be to create a state diagram for a simplified vending machine. Say a pop machine. For simplicity, say it has only one flavor of pop. Takes only one coin (e.g. quarters), add others later. So inputs include quarters, dispense button, cash back button. Maybe an "empty" sensor. Outputs include refund, a can of pop, "Empty" sign. Another good exercise might be a simplified elevator. Start simple, two floors and add features.

Maybe use a whiteboard for sketching the state machine.
 
Top