2 How to Solve State Machines: Traffic Light State Machine
Solving any state machine can be done in six steps:
- Identify the states, inputs, and outputs.
- Create a state diagram.
- Create a state transition table.
- Create an output logic table.
- Derive Boolean equations state transition and output logic tables.
- Implement logic.
These steps can be demonstrated by solving the state machine for a traffic light controller at a four-way intersection. A traffic light controller needs to show a particular combination of lights to indicate whether North/South or East/West bound traffic can proceed. In this system, the output is a set of red, yellow and green lights that indicate whether traffic should go, slow down or stop. The system may also have an emergency signal to override the normal traffic flow.