Chapter 8 is a state machine design example. The state machine controls a virtual electric train simulation with video output generated directly by the FPGA. Using track sensor input, students must control two trains and three track switches to avoid collisions. An actual model train layout can also built using the new digital DCC trains interfaced to an FPGA board.
Two trains, we’ll call A and B, run on the tracks, hopefully without colliding. To avoid collisions, the trains require a safety controller that allows trains to move in and out of intersections without mishap.
As an example, assume Train A always runs on the outer track loop and Train B on the inner track loop. Assume for a moment that Train A has just passed Sensor 4 and is near Switch 3 moving counterclockwise. Let’s also assume that Train B is moving counterclockwise and approaching Sensor 2. Since Train B is entering the common track (Track 2), Train A must be stopped when it reaches Sensor 1, and must wait until Train B has passed Sensor 3 (i.e., Train B is out of the common track). At this point, the track switches should switch for Train A, Train A will be allowed to enter Track 2, and Train B will continue moving toward Sensor 2.
The controller is a state machine that uses the sensors as inputs. The controller’s outputs control the direction of the trains and the position of the switches. However, the state machine does not control the speed of the train. This means that the system controller must function correctly independent of the speed of the two trains.
An FPGA-based “virtual” train simulation will be used that emulates this setup and provides video output. Since there are no actual power circuits connected to a train on the FPGA board, it is only intended to give you a visual indication of how the output signals work in the real system. The following sections describe how the state machine should control each signal to operate the trains properly.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
For those familiar with earlier editions of this book, additional track power signals were required for power control relays. This new train problem is based on newer digital DCC model trains and it no longer needs the track power signals and relays, so they have been eliminated. The signals work exactly the same as the previous train setup, if you assume that track power supply A always runs train A and track power supply B always runs train B.
DCC standards are approved by the National Model Railroad Association and are available online at http://www.nmra.org/standards/DCC/standards_rps/DCCStds.html.
Additional details on using FPGAs for DCC can be found in “Using the Using FPGAs to Simulate and Implement Digital Design Systems in the Classroom”, by T. S. Hall and J. O. Hamblen in the Proceedings of the 2006 ASEE Southeast Section Conference.
Rights and permissions
Copyright information
© 2008 Springer Science+Business Media, LLC
About this chapter
Cite this chapter
(2008). State Machine Design: The Electric Train Controller. In: Rapid Prototyping of Digital Systems. Springer, Boston, MA. https://doi.org/10.1007/978-0-387-72671-7_8
Download citation
DOI: https://doi.org/10.1007/978-0-387-72671-7_8
Publisher Name: Springer, Boston, MA
Print ISBN: 978-0-387-72670-0
Online ISBN: 978-0-387-72671-7
eBook Packages: EngineeringEngineering (R0)