About the Interface
 
     The main advantage of having the old Timex interfaced with the layout is that I can finally enjoy fruits of my labors without being tied to the control panel.  (Before the interface, I could only view layout operations from one angle, from the control panel on the far side.)  What a pleasure is it to see (up close) the Amtrak passenger train stop on its own, back into a siding after a track switch was "magically" thrown, then stop at the intended spot.  A sound effects tape and boom box, with station announcements and background sounds, is also magically activated.  The sound effects could be activated by a track controlled relay like other things on the layout (without the computer), but an unused pole of a computer controlled relay was available.  I use a small, wired homemade remote (door bell switches) that I can use for controlling the AtuoTrain feature and blowing the whistle in the Lionel tender, but I wanted a hands-free way to put the layout through its paces and still be able to walk about and talk to visitors.  Without the I/O board, it is easy for a visitor to cause a distraction and then operator error comes into play.  But the old Timex is not easily distracted.  Another advantage is that certain things like the Flyer and figure eight twin train can be turned on and off for just a few minutes, eliminating some noise and cutting down on the wear and tear of this equipment.  The layout, excluding the track switches, is set up to run continuously without the computer, with track voltages pre-set so no throttle control is necessary, just track voltage is either "on" or "off."  (But throttles can be used when the computer's I/O board isn't in use.)  Eventually a random routine will be controlled by the computer, but the present program just demonstrates the layout, controlling 5 trains, equipment running on HO track, track switches (or turnouts as they are called in model train circles), animation and other features.  Many combinations of activities are possible, but there are limits since there are only eight outputs, and although two different banks of relays and other techniques are used as a way of maximizing control, certain things can't be controlled at the same time.

     Most of the animation will only stop at a particular point in their operation regardless of when power is cut to them by the computer or operator.  So, for example, when Snoopy is skating on his rink and the computer cuts his voltage, he will still operate until he is out of sight in his tunnel because his motor gets constant voltage except for a short section of travel within the tunnel, and that short section within the tunnel is what is actually being controlled.  The gold mine feature is also automatic without the computer except for controlling the one track switch and track polarity which allows the handcar to return to or exit the tunnel.  A diode trick, below, keeps the handcar in the blind tunnel until the polarity is reversed.



     The action at the HO/O27 crossing is also automatic, but the computer will stop a vehicle under the covered bridge and allow its release so that the train and vehicle reach the crossing at the same time, so the full 'drama' of the stopping and illuminated headlights can be appreciated.  Without the help from the computer, the train and a vehicle almost never approach the crossing at the same time.  The crossing, although it seems simple, took a great deal of work, figuring how to get relays to latch, and, before that, the long process of finding the HF AC circuit and building the high frequency alternating current generator.  The on-line and off-line model railroad community helped me locate the correct HF AC circuit information, helped with a beginner's electronics questions, but most importantly gave the needed encouragement and moral support.



     Above is a simple example.  When the I/O board is in control, there are two separate approximately 15 inch long computer controlled track sections of the S gauge track.  Each section is connected through one computer controlled relay.  The rest of the track gets constant or variable voltage.  That train will be activated by the computer when the hidden track section, near the rear layout corner, gets power for a few seconds, just long enough for the train to leave the usually 'dead' section and then travel until it reaches the second dead section by the rural station.  It will remain there, stopped, until the computer applies power again.  So one relay will either stop or start this train at two separate positions on the track.  There are no devices in these tracks to activate the I/O board's inputs.  The stopping and starting is based on timing, which isn't critical for this train.  This AC train is locked into forward so it will always start in the forward direction.

     The down side is that programming and debugging takes a fair amount of work, so time can't be spent on making things, maintenance, and other projects for the layout.  Fortunately, the current program has worked well and just needs a few extra lines to allow for certain layout malfunctions, like Lionel reversing unit problems and stalled vehicles, to be recognized and handled.  Lines 302 and 303 will recognize that the train is stalled in neutral because the counter has reached its end.  The train should reach the station platform before the counter reaches 75, so it is safe to assume that the train has stalled.  There are inputs from the tracks that will allow for calculating average times for a train or vehicle to reach a certain location after departing another location.  And if these times are exceeded, then there is a malfunction which can then be handled.  These extra program lines will add to program size, execution time, and loading time from cassette recorder, which can take at least a few minutes.  But once a program is perfected, the bulk of the work is done, then some fun can be had with a little tweaking here and there.  Better BASIC programming techniques, like subroutines, use of more variables, and generally tighter code, will help to keep the program a more manageable size.

     Because the Timex/Sinclair 1000 doesn't do AND, NOT, and OR operations like other versions of BASIC, when B = PEEK 16381 and V = 1,2,4,8,16,32, etc., the IF INT (B/V) <> INT ((B/V) + 0.5) THEN.... is the best way I have discovered to unpack the input byte and pick out one bit in just one program line.  Extra lines in the critical loop will just slow down the execution of the T/S BASIC program.

     The bottom line - The computer is an aid and a tool, and a hobby in itself, and only adds to my pleasure!!!

[back to computer interface page]

[back to T/S program]

[back to main page]