Yard Program Description |
This page contains the documentation portion of the Basic Stamp 2 program that controls the yard and industrial spur turnouts. The complete code and documentation can be downloaded using this link: YardRoute.zip
' ====================================================================== ' YardRoute.bs2 9-02-2003 ' ' Yard Track Routing and Turnout Control ' ' This program controls the turnouts (Yx) of the yard and approach tracks ' on the D&B model railroad. Multiple keypads are positioned on the layout ' for the purpose of setting the route a train will follow. Any keypad can ' be used to set a route based upon the input of two track number values. ' The following diagrams the track and turnouts involved. ' ' ~ ' | T7 ' /------------------------|\-------------------------------------\ ' / \ ' 1 \ / / / / / / / 2 ' / \ / / / / / / / \ ' \ \ / / / / / / / / ' \ 14 15 6 7 8 9 10 11 / ' \ \ / / / / / / / / ' \ ------- 13 ---\Y18 Y15/--Y16/ / / / / / / ' \ \ / / / / / / / / ' \ ---- 12 --Y17\-----/ /Y12/Y11/ /Y13/Y14/ / ' \ / / Y3 / ' Y1 \---------Y5\-----------Y9/--- 5 ---Y10/----/Y8-------/-/ Y4 ' \ Y2 16 16 / / ' \-\---------\Y6------------- 4 -------Y7/---------/ / ' \ / ' \----------------------- 3 -------------------/ ' ' ' Operational Requirements: ' ' All yard and approach tracks are assigned a number; 1 through 16. The ' numbered keys of the keypad correspond to the numbered tracks. A route ' is specified by keying in two track numbers. The first number entered ' is the "from" track. It is the track currently occupied by the train. ' The second number entered is the "to" track. It is the desired destin- ' ation track for the train. Once both numbers are keyed in, turnouts ' for the specified route will be set appropriately. Key combinations ' that do not correspond to a valid route will be ignored and a warning ' tone will be sounded. ' ' Keying in the same number for the "from" and "to" tracks will set the ' turnouts to route just the specified track. This is also useful for the ' following operations. ' ' Track 4 or 5: Will set all turnouts on both of these tracks to their ' normal (straight) position. ' Track 16: Will open the four turnouts Y5 through Y8 for a "run ' around" operation. ' ' There are two special cases that must be handled. For a track 4 to 5 or ' track 5 to 4 request, the turnouts used are train direction dependent. ' Since the train direction is not known, the code initially sets turnouts ' 5 and 6 for track 4 to 5 and turnouts 7 and 8 for track 5 to 4. If the ' same track command is consecutively entered, the code inverts the ' settings of turnouts 5/6 and 7/8. ' ' The approach and yard tracks form a reverse loop which is electrically ' isolated from the mainline. The polarity of this loop is controlled by ' the ReverseLoop.bs2 program based upon the position of wye turnout T7 ' and the train sensors associated with it. Refer to the ReverseLoop.bs2 ' program for details on its operation. Since there are no reverse loops ' within the yard tracks, no power polarity control is required. ' ' Position feedback information is not used for the yard turnouts since ' no automatic turnout positioning functions are performed by this ' program. Only the turnouts for the selected route will be affected. ' The program remembers turnout positions as they are set during oper- ' ations. This information is referenced during subsequent operations ' to skip the setting of turnouts already in the proper position. No ' default turnout positions will be set or assumed at power up. ' ' To facilitate keypad entry, an indicator is positioned next to each ' keypad. This indicator will be illuminate when the first track number ' is entered. It will extinguished when the second track number is ' entered. ' ' Hardware Description: ' ' Refer to schematic page 3 for the hardware circuitry associated with ' this description. ' ' This program utilizes the Basic Stamp 2 micro controller which has 16 ' I/O bit positions. External interface chips (74C922) are used to ' encode and debounce the keypads. Output multiplexors (74154) are used ' for interfacing the turnouts. Two output bit positions are assigned to ' control each turnout. See constant definitions below. The cross over ' turnouts Y5/Y6 and Y7/Y8 are wired for controlled by a single pair of ' bit positions since both turnouts must always be changed together. ' ' Turnout operational current requires that a driver circuit be used ' for each turnout coil. When a turnout is to be positioned, this program ' pulses the appropriate output bit for a nominal 200 ms. This causes the ' driver to energize the turnout coil. ' ' An output pin of the Basic Stamp is connected to a speaker and used ' to sound warning tones. A warning tone is output when an invalid route ' is specified. ' ' An output pin of the Basic Stamp is connected to a Led and used to ' indicate operation (heartbeat). Flashing indicates that the code ' is cycling in the main program loop. ' ' Two output pins of the Basic Stamp are each connected to a Led and used ' to indicate the state of entry for the track numbers on each keypad. ' ======================================================================
Navigation: Yard D&B Home Buczynski.com Index
Copyright © 2006 Don Buczynski
San Diego, California