Digital Signal Processing Reference
In-Depth Information
8.3 Switch Direction Outputs (SW1, SW2, and SW3)
Switch directions are controlled by asserting the SW1, SW2, and SW3 output
signals either high (outside connected with inside track) or low (outside tracks
connected). That is, anytime all of the switches are set to 1, the tracks are setup
such that the outside tracks are connected to the inside tracks. (See Figure 8.3.)
If a train moves the wrong direction through an open switch it will derail. Be
careful. If a train is at the point labeled "Track 1" in Figure 8.3 and is moving
to the left, it will derail at Switch 3. To keep it from derailing, SW3 would need
to be set to 0.
Also, note that Tracks 3 and 4 cross at an intersection and care must be taken to
avoid a crash at this point.
Switch 3
Track 1
Track 3
Sensor 5
Sensor 1
Sensor 2
Sensor 3
Sensor 4
Track 4
Track 2
Switch 1
Switch 2
Figure 8.3 Track direction if all switches are asserted (SW1 = SW2 = SW3 = 1)
8.4 Train Sensor Input Signals (S1, S2, S3, S4, and S5)
The five train sensor input signals (S1, S2, S3, S4, and S5) go high when a train
is near the sensor location. It should be noted that sensors (S1, S2, S3, S4, and
S5) do not go high for only one clock cycle . In fact, the sensors fire
continuously for many clock cycles per passage of a train. This means that if
your design is testing the same sensor from one state to another, you must wait
for the signal to change from high to low.
As an example, if you wanted to count how many times that a train passes
Sensor 1, you can not just have an "IF S1 GOTO count-one state" followed by
"IF S1 GOTO count-two state." You would need to have a state that sees
S1='1', then S1='0', then S1='1' again before you can be sure that it has
passed S1 twice. If your state machine has two concurrent states that look for
S1='1', the state machine will pass through both states in two consecutive
clock cycles although the train will have passed S1 only once.
Another way would be to detect S1='1', then S4='1', then S1='1' if, in fact, the
train was traversing the outside loop continuously. Either method will ensure
that the train passed S1 twice.
 
Search WWH ::




Custom Search