2.1 Step 1: Identify States, Inputs, and Outputs
The first step in solving a state machine is to identify the possible states, inputs and
outputs of the system. In the case of a basic traffic light system there are five
states. These states, along with their corresponding encodings, are summarized in Table 2-1.
State | Description | Binary Encoding |
---|---|---|
North/South (N/S) GO | North/South bound traffic can proceed. East/West traffic must stop. | 000 |
North/South (N/S) SLOW | North/South traffic is about to transition to stop state. Traffic should slow down and proceed with caution. | 001 |
East/West (E/W) GO | East/West traffic can proceed. North/South traffic must stop. | 010 |
East/West (E/W) SLOW | East/West traffic is about to transition to stop state. Traffic should slow down and proceed with caution. | 011 |
Error | An emergency or error has occurred and traffic should stop at the intersection and proceed with caution | 100 |
The outputs of the system can also be summarized as in Table 2-2.
Name | Description |
---|---|
NSG |
1 = North/South Green and East/West Red ON 0 = North/South Green and East/West Red OFF |
NSY |
1 = North/South Yellow and East/West Red ON 0 = North/South Yellow and East/West Red OFF |
EWG |
1 = East/West Green and North /South Red ON 0 = East/West Green and North/South Red OFF |
EWY |
1 = East/West Yellow and North/South Red ON 0 = East/West Yellow and North/South Red OFF |
ERR |
1 = All red lights flashing ON/OFF 0 = No error state |
This traffic light system will only have one input to switch the system into the emergency
state:
Name | Description |
---|---|
E |
0 = Emergency is not present 1 = Emergency is present |