Step 1: Describe the machine in words. In this example, we’ll be designing a controller for an elevator. The elevator can be at one of two floors: Ground or First. There is one button that controls the elevator, and it has two values: Up or Down. Also, there are two lights in the elevator that indicate the current floor: Red for Ground, and Green for First. At each time step, the controller checks the current floor and current input, changes floors and lights in the obvious way.
Step 2: Draw the FSM diagram
• Up
• Ground
• [Red on, Green off]
• First
• [Red off, Green on]
• Down Up
• Down
In this diagram, the bubbles represent the states, and the arrows represent state transitions. The arrow labels indicate the input value corresponding to the transition. For instance, when the elevator is in the Ground state, and the input is Up, the next state is First. The information in …show more content…
• An intimate relationship with directed graphs having arcs labeled with
• symbols from the input alphabet. Finite State Machine.
Finite state machines represent a very powerful way of describing and implementing the control logic for applications. I have used them to implement communication protocols, to control the interactions in a GUI, and many many other applications. FSMs are powerful because they are a very dense representation. A lot of logic can be represented by a relatively small diagram. They are powerful because they follow very simple rules, and are easy to verify. And they are powerful because they can be used to generate code. There is one button that controls the elevator, and it has two values: Up or Down. Also, there are two lights in the elevator that indicate the current floor: Red for Ground, and Green for First. At each time step, the controller checks the current floor and current input, changes floors and lights in the obvious