Mark DiVecchio's O-Gauge Train Layouts

1992 Layout Page

2006 Layout Page

2009 Layout Page

P&LE Postcards by Howard Fogg 

Plasticville Buildings

Portable Layout Page

Train Clubs

Bing Track


YouTube Channel

OOK Radio Support

ADPCM - Playing clips from .mth sound files

3D Prints for my Layout

More RTC Videos

Technical Videos

P&LE McKees Rocks Locomotive Shop
3D Printer Project

White Tower Restaurant
3D Printer Project

RFID Train Detection

Engine and Car Operation
Hints and Tricks

RFID Tag Programmer using PN532

RTC Control Language - Scripting

RTC WiFi Support
Getting rid of (most of) the wires

More RFID Tag Videos

RTC Control Language - Signaling

RTC - Remote Train Control

This Page last updated on .

This page shows a few videos and screen captures of a program that I wrote. I titled it "RTC" or Remote Train Control. Here is the discussion on the OGR Forum:
http://ogrforum.ogaugerr.com/topic/pc-control-of-mth-engines-by-serial-connection-to-the-tiu

This web page talks about the RTC program and its original wired interface to the TIU - that is, using the tethered phone cord connection. While you read this, keep in mind that I have now developed a radio interface to the TIU.

I don't recommend that anyone build this wired interface (unless you are just interested in trying it). But I recommand that you go directly to the radio interface using the links below.

Now let me update that comment. Yes the CC1101 radio interface was a great improvement over the wired interface. Once you understand how the radio works, you can look at http://www.silogic.com/trains/WiFi.html where I now use WiFi signalling to connect the RTC program to the WIU & TIU combination or to the (soon to be released) WTIU.


Still, read this page to learn about the RTC program itself.

March 21, 2015 8:19 PM

PC Control of MTH Engines by Serial Connection to the TIU

To me, MTH makes the best engines and rolling stock for my railroads of choice, the Pittsburgh & Lake Erie Railroad and the Aliquippa & Southern Railroad (where my grandfather worked). MTH has many many engines and dozen of pieces of rolling stock for these railroads. My layout uses only MTH's DCS.

DCS has been out for almost 15 years. I've been waiting for a way to control my layout using my PC. I've always used Windows PC's so this effort was done originally using XP (Mark's note: XP is no longer supported) and more recently Windows 7 and Windows 10.

A few years ago, Mike Hewett <mhewett737yahoo.com> presented a PC interface to the tethered mode of operation of DCS. He showed how to sniff out the RS-232 packets running between the Remote and the TIU, how to save those packets and how to later transmit those packets to the TIU from the PC.

Mike presented his findings in three videos which he produced around May of 2011. Look at those three videos before you continue with my description.

Chapter 1 https://www.youtube.com/watch?v=MxlUb-YccZw
Chapter 2 https://www.youtube.com/watch?v=IBrhLSVHjIo
Chapter 3 https://www.youtube.com/watch?v=oqaeeR3pgPw

Look at this OGR Forum thread for a followup:

http://ogrforum.ogaugerr.com/topic/wonderful-gift-dcs-to-pc-control?reply=5371679459030161#5371679459030161

Mike made more progress as shown in this video from 2013

https://www.youtube.com/watch?v=Ug5CSZFwo-c

I think that I first saw what Mike did around October of 2011 as my earliest date stamps on files that I've saved are from that date.

Mike's methodology was to record the packets sent by the Remote when each key on the Remote was pressed. Without regard to the contents of the packets, he saved them in a file. Then, later, his PC program could read up those saved packets and send them to the TIU. He created a very nice touch screen interface and he could run his DCS trains from his PC.

I contacted Mike back then and he sent me copies of his program and I was able to build up his interface to the TIU, sniff out the needed packets and I had a way to control my trains from my PC.

This worked up to a point. When I added a new engine number, I had to run the packet sniffer again and pick up the packets needed for the new engine number. Mike's program only captured a subset of the many, many types of commands that could be sent to the TIU. Mike did not read back responses from the TIU or process any of those returned packets.

I was looking for something more. I needed to understand the protocol over the tether cable.

With a lot of effort, I was able to understand almost all of the communications between the Remote and TIU. I am now able to create packets to control the DCS engines. The packets are complete with correct addressing, command syntax and CRC.

I figured this out by examination of the packets that I could sniff using Mike's original RS-232 interface design and the port settings that he found. Without Mike's insights into the RS-232 data stream, I don't think that I would have been able to get a foothold into this protocol.

So again, I figured this out just by looking at the RS-232 stream over the tether cable. No code disassembly, no logic analyzers, no opening up of Remotes or TIU's.

March 25, 2015 10:19 PM

I'd like to thank everyone for taking the time to comment on my posting. I've waited to follow up so I could add my thoughts to the comments.

My purpose in what I did was to develop a new way to run my trains.  I'm not competing with anyone else, especially MTH since they don't have a product for PC control that they sell or give away. I'm not selling anything that I've done. Once I determine that it is working fairly well, I am going to send the program to whoever can use it. It will probably be distributed under one of the GNU Public Licenses.

Understanding the protocol over the tether is what is most useful. Mike (skylar) wrote about wanting to build a system with sensors that adds location information to the mix. I can envision something like the operation of the Lionel 132 Automatic Stop Station that you could automate with location sensors and PC control.

The DCS patent does not talk about the protocol over the tether. I've learned from my analysis that the protocol is an industry standard RLL(0,1) which is just a fancy way of saying how often the RS-232 signal changes from 1 to 0. Part of the encoding is actually patented and not by MTH - #5,625,644 issued in 1997. The next part uses Morton or Z-Curve encoding. You can Google that. Third are the commands themselves. They are in ASCII and are based on an Application Note published by Microchip Technology in 2002, look for AN759. Another document, AN752, describes the MCRF4XX CRC protocol used. These public documents describe the protocol completely, it was just adapted to model train control. All of these documents were found on the Internet.

PC control has one (at least) major drawback and that is the need for a wired connection to the TIU. My program only handles one RS-232 port but there is no reason that a program could not be written that uses 5 RS-232 ports, each connected to the 5 TIU possible. In other words, once the protocol is known, practically anything can be done by writing software. I haven't yet completed my analysis of the protocol. My program knows all of the train control commands and AIU commands. I know how to do lashups but I haven't added that to the program. I've not yet looked at a TMCC interface or conventional operation.

(Update Apr 2015 - RTC now handles Lash Ups and Conventional operation)
(Update Oct 2015 - RTC now communicates wirelessly with up to 5 TIU)

Writing a program that encompasses every aspect of train operation is not something one person can do alone. Maybe because of that, PC control will never be practicable. It is not possible for me to singlehandedly write a program that will satisfy everyone. But I can probably do enough to let enterprising and interested hobbyists have the ability to operate their trains in a different way.

My program, RTC, was written using Borland C++ Builder 4.0 because that is the software that I used years ago when I was still working. There are probably other better environments which would better handle the real-time control aspects (like asynchronous RS-232 characters arriving). C++ Builder is not really good at that. When I started writing the program, I had no idea what the protocol over the tether was. I had to write my program to handle many different protocols, of which all except one turned out to be deadends. For example, I used CRC code that could handle dozens of CRC algorithms. But only one was needed once I understood which one. All of that extra code is still in the program. The CRC code, by the way, was written by Ross Williams, who placed it in the public domain in 1993.
As I mentioned in the posts on the forum, I am releasing my program and documentation under the  GNU General Public License Version 3 and GNU Free Documentation License Version 1.3. These licenses permit anyone to use the program and the documentation to produce follow on programs as long as those programs remain covered by the GNU licenses.

The Free Software Foundation web page talks about what "free software" means.

For more information, look on the Open Source Initiative web site which includes a description of what  Open Source means and their certification of the GPL version 3.

Here is the copyright notice for those two licenses:


GNU GPL

Remote Train Control Program for Windows
© Copyright 2015 by Mark DiVecchio

Remote Train Control is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Remote Train Control is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

GNU FDL

This is part of the Remote Train Control Manual.
© Copyright 2015 by Mark DiVecchio

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. You should have received a copy of the GNU Free Documentation License along with Remote Train Control. If not, see <http://www.gnu.org/licenses/>.

Important note: Before you can use an engine with RTC, the engine number must be changed from the factory reset setting of zero. Use a Remote and TIU as usual to perform the Add MTH Engine operation.


Communications with the TIU

As you read through these pages, you will learn of the three different ways developed to communicate between the PC and TIU:

1. Wired Interface - below is shown the first way developed with the help of Mike Hewitt. This method will still work but it was really superceeded by method #2. Don't use this method.

2. Infiduino/Seeeduino and CC1101E Radio - This method is described on the OOK Radio Support web page. For most users, this is the way to go

3. ESP8266 with WiFi and CC1101E Radio - This method is described on the WiFi web page. It is probably the cleanest way to go but it requires a little more work and understanding about WiFi and Routers.



Getting the RTC Program

If you have already watched these videos and just want to download the RTC program, Click Here.

You can get a detailed description of the serial protocol to the TIU here (Serial Data Stream Decoding - 4 Sep 2020). And a description of the command set here.

From when I recorded some of these videos, the user interface has changed slightly. You can also access these videos on my YouTube Channel.

Videos recorded in May 2019 are in this YouTube Playlist.

RTC Program running on Win7 Computer


Video 1 - Recorded 19 Mar 2015. The first video is an introduction to program showing a screen capture and audio. Its running on a computer in my train room.

Image loading....


RTC Program running on Win7 Computer


RTC running 3 engines

Video 2 - Recorded 22 Mar 2015. Here is a screen capture of the running of three engines at the same time with freight yard announcements on one of the engines.

Image loading....


RTC running 3 engines


Recording and Playback

Video 3 - Recorded 22 Mar 2015. This screen capture shows the ability of RTC to capture packets sent to the TIU and to play back what is captured.

Image loading....


Recording and Playback


My layout with 3 engines under playback control by RTC

Video 4 - Recorded 22 Mar 2015. Here is a playback of a recorded session based on Video 2, above. This video features an Aliquippa & Southern SW1200 and its freight yard announcements. My grandfather worked for the A&S in my hometown of Aliquippa, PA.

Image loading....


My layout with 3 engines under playback control by RTC


AIU control of Accessories and Switches

Video 5 - Recorded 25 Mar 2015. This video shows the AIU control screen. RTC can save names and TIU/AIU associations for 25 AIU.

Image loading....


AIU control of Accessories and Switches


Tour of the Main Window of the RTC program

Video 6 - Recorded 25 Mar 2015. This  is a tour of the main window of the RTC program, with a description of what each button and selection does..

Image loading....


Tour of the Main Window of the RTC program



Conventional Operation - Screen Capture

Video 7 - Recorded 9 Mar 2015. This video shows my first cut at a Conventional Mode Operating Screen. I haven't yet tested this with a real engine on a track. I connected a voltmeter to the TIU output and monitored the voltage changes...

Image loading....


Conventional Operation - Screen Capture



Creating and Running a 3 Engine LashUp - Screen Capture

Video 8 - Recorded 9 Apr 2015. Here I'm creating and running a LashUp of three engines while recording it for later playback. (Look at Video 9)..  

Image loading....


Creating and Running a 3 Engine LashUp - Screen Capture



Playback of 3 Engine LashUp

Video 9 - Recorded 9 Apr 2015. This is a video of the three engines running on my layout using the recorded file from Video 8...

Image loading....


Playback of 3 Engine LashUp



More Videos here.

1978 May - Model Railroader

Wired Interface between the TIU and the PC:

The wired interface to PC uses a fairly simple RS-232 signalling. Here are some details. I built up this interface on a prototyping breadboard. Please understand that this worked for me but you assume any risk of damage to your TIU, PC or layout..

Major parts:
    1. USB to RS-232 adapter. Must use 3.3v levels. I used the Pololu Adapter #391. Source Pololu web page. Other adapters are fine as long as they output 3.3v levels (many of the FTDI based adpaters output 5v levels).
    2. Handset cord - this is the coiled cord normally found between the handset and the phone base (NOT the flat cord between the phone base and the wall jack). The cord is usually coiled. Some of these have only 2 wires; we need one with four wires. Generally called a "4P4C" cable. Good sources : Thrift Stores, Walmart, RadioShack.
    3. Texas Instruments (TI) CD4503BE 3-state buffer in a PDIP (Plastic Dual In-Line Package). Good sources: Mouser Electronics. and Digi-key.
    4. Prototyping board - also called a Breadblock. I used a board from MJPA. #19048. Any other physical way you want to build interface this is fine. Placement of parts and wiring are not critical.
    5. USB cable - USB A Male to USB Mini-B (5 pin) Male. Good sources : Pololu, Amazon, China, Inc (or a million other places).

Software:
    You will need the serial port drivers for whichever USB to RS-232 adapter you are using. If you use the Pololu #391, the drivers for Windows XP, Vista, 7 & 8 are here. Follow the instructions on that web page to install the drivers. When you install this driver, note the COM port number that Windows selected for you. You will need to select that port on the Setup window in the RTC program.

    In the RTC program, the first time you run it, click the Setup button, then in the "Mode Select" radio button box, be sure to select "Wired" and then select the correct COMx port. . These settings will be remembered each time you run RTC.

    The RTC program itself can be copied to any folder. I suggest that you make a folder called "RTC" or something like that. Copy the program into that folder. Create a link on your desktop to the "remote_control.exe" file which is the program. When the program first runs it will create its database files in that folder.  There is no special, separate "installation" or "setup.exe" to run.

Design:

4P4C Handset Cord

My implementation on a Breadboard

Breadboard Wiring

Schematic

USB A Male to USB Mini-B (5 pin) Male



Supporting Documentation:

    Pololu - Pololu USB-to-Serial Adapter
    Pololu USB serial port drivers
    AN752 CRC Algorithm for MCRF45X ReadWrite Device
    US5625644 DC Balanced 4B-8B Binary Block Code for Digital Communications
    A Painless Guide to CRC Error Detection Algorithms
    CRC Reverse Engineering  
    Z-order curve
    Decoding Morton Codes
    3 X 170 Point Mini Solderless Breadblocks in Red, White & Blue
    TI CD4503 Datasheet



Here is an interface used by one of my alpha testers. Its a simple interface that does not offer the "disconnect on idle" function because the CD4503B is not used. Its still a good working interface:




Another alpha tester used this USB to serial adapter (ebay link) :  CP2102 USB 2.0 to UART TTL 6P Module Serial Converter Adapter

This adapter is actually pretty nice because it has 3.3V and DTR already on header pins. You won't have to wire jumpers as I had to using the Pololu adapter. The CP2102 operates at 3.3 volts so its output voltage levels are compatible with the TIU.

Driver here:   //www.silabs.com/products/interface/usbtouart/Pages/usb-to-uart-bridge.aspx

Here are some photos of this tester's interface. Its a good example of how you can build a solder-less implementation:


Circuit schematic. The circuit is the same as the one I built.

The CP2102 and the CD4503. The nice thing about this CP2102 board is that all of the needed signals breakout onto pins. These pins can then be connected without soldering. (remember on my USB adapter, I had to solder wires to the board for 3.3V and for DTR.

The CP2102

Connecting the handset cord with "Scotchlok 3M Type Red Button UR3 Type Phone Splice Connector Wire Crimp Connectors".
Here is a source.



Results from another alpha tester:



This tester found a cable with the wire colors in a different sequence than the cable I have.
His wires are Red-Black-Yellow-Green. I thought the colors were standard but I guess not!

He had to swap around the connections before his interface worked.

Here is his final interface hardware. Now it works!


Another user sent me a photo of his wired interface. Looks and works well.





Getting the RTC Program

On 8 Sep 2015, I made the RTC program generally available. It has undergone testing by a group of alpha testers and it has now met my standard of "good enough". The alpha testers (thanks - you know who you are) found problems which I fixed and I added some features over the months. You can contact me on the OGR Forum "SanDiegoMark" or you can email me (mailto: link at bottom of each web page) with problems and questions.

You can download the program (v4.5.0 - 29 Mar 2023) here:  Remote Train Control ZIP file. You may note that some of the current windows of RTC look a little different than what is shown in these older videos. You should be able to figure it out. Links to the source code are near the bottom of this page. This is the version of RTC as described on the RTC Control Language - Scripting web page. The newest versions of RTC distributed here will only run on Windows 7 or newer. Contact me if you need a version of RTC which will run under Windows XP.

v5.0.0 the newest version that supports WiFi. Is not here yet. If  you want to beta test it, email me.

To support the new Lua scripting features of version 4 of RTC, a few more files are needed to be present in the folder containing the program (Remote_Control.exe). All of these files and folders are present in the distrubution ZIP file. Create a folder somewhere and name it whatever you like, something like "RTC". Then populate it with files from the distrubution like this:
  1. Remote_Control.exe
  2. libeay32.dll
  3. lua535dll.dll
  4. ssl.dll
  5. ssleay32.dll
  6. Folder and contents : lua
  7. Folder and contents : mime
  8. Folder and contents : Scripts
  9. Folder and contents : socket
  10. Folder and contents : ssl
  11. Folder and contents : rtcgraphs
  12. Folder and contents : luagraphs
  13. Folder and contents : std
Your computer may also let you extract all files from a ZIP file by right clicking on the ZIP file and dropping it into a folder. If you can do that, the folder structure will be created automatically.

RTC Videos are in this YouTube Playlist.

Inside that ZIP file is some additional documentation that might help get you going. One of the docs included are simple operating instructions (for the wired version of RTC) which can be directly downloaded here (the wired veresion is obsolete) and for the radio version of RTC, you can download the simple operating instructions here. For the WiFi version of RTC, follow along on this page: http://www.silogic.com/trains/WiFi.html .

Sometimes, it takes me a few days/weeks/months to get the latest version of the source code on this page. If you need it and its not here yet, drop me an email.

The readme file:

Remote Train Control Program for Windows

(c) Copyright 2015 by Mark DiVecchio

    This file is part of Remote Train Control.

    Remote Train Control is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

    Remote Train Control is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

----------------------------------------------------------------------------------------------------------
Installation

0. Read through this readme file and read the GNU Public and Documentation Licenses.

1. Create a folder somewhere, call it "RTC" or something like that.

2. From the ZIP archive, extract the program "Remote_Control.exe" and put it into that folder.

3. Build one of the TIU interfaces (wired or radio) shown on my web pages. Read the file "Remote Control.pdf" from the ZIP archive.

4. Double click on the program name to run it or create a shortcut on your desktop.

5. Look at my on-line videos and read the popup hints you get when you mouse over the controls

6. Good Luck
----------------------------------------------------------------------------------------------------------
Release Notes:

V 0.0.2.10   12 Apr 2015

1. Hopefully repaired the memory allocation bug

V  0.0.2.32  16 Apr 2015

1. Changed how the conventional mode voltage slider works. You can now enter the actual input voltage and the program will display the actual output volage on the slider. Or you can tell the program that the input voltage is 22v and the slider will work just like the Remote.

2. Special functions menu on the Operation Window. Right click for menu Coors Door open and close : CDO and CDC (not sure yet about CDS).   < more to be added as found>

3. If you presss the PFA button with the shift depressed, the automatic sequence is disabled. You muct press the Direction toggle 4 times just like with the remote. NOTE: I may reverse this sometime so shift causes the automatic sequence.

4. Added Electric Engine type, click on the type name in the Operations screen. The type is saved from run to run. (RTC can determine if an engine a is Steam or Diesel but I've not yet found a way to tell if its an Electric.)

5. Added Electric Engine Pantograph controls. You must change the engine type  selection to Electric for these to be visible.

6. Added RTC Main Screen popup menu
    1. DCS Setup - same functionality as the item on the Remote.
    2. RTC Info - this displays the copyright information and then sets a flag so that the copyright popup is not displayed any more.
    3. Reset RTC Registry - this resets all of the non-commuications preferences from the Setup screen and exits from the program.

7. On the Sound Control screen, I added Boiler (FPR & FBS) and coupler (SCC and SCS) sounds buttons along with a Train Wreck sound button (STW). Engine type must be set to Electric    for the Boiler buttons to display.

V 0.0.2.33   16 Apr 2015

1. "Speed mode" was too fast for the TIU. I had to put a short delay in each transmission.

V 0.0.2.53

1. I created a TX only mode for when the TIU to PC path is not working. This is not a good long term use. You should get that path working. Set this in SETUP in Debug Mode. Select "TX Only Comm", set "# Retries" to 1 or 2 and set "Speed Mode". In this mode of operation, commands which require data back from the TIU will not work. Only available in Debug Mode.

2. Repaired a second memory allocation bug

3. I've realized that LashUps will probably not work in Speed Mode as some commands used by LashUps take several times longer than regular commands to be processed in the TIU. Try it but you might have trouble.

4. On the Engine List popup menu (right click), I've added options to set the engine into Command Mode, Legacy Mode and Conventional Mode.

V 0.0.2.60

1. I've added some code to make the horn/whistle buttons on the operations screen a little less sticky. Generally, clicking those button very quickly causes the problem. When you click them, click deliberatly and slowly.

2. The TIU box in the upper right of the main screen now shows the status of the communications with the TIU:
    white:    communications not attempted yet
    green:    last communications successful
    red:    last communications failed
    yellow:    communications in test mode (eg: "TX Only Comm" is set)

3. Fixed a "Critical Section" error. For the techy types, the VCL controls that I use in the Borland C++ Builder environment are not thread safe. I had to have the RS-232 part of the program send a message to the VCL part of the program for certain operations.

4. Added a "Drop DTR on Idle" mode. Now when RTC has been idle for 10 seconds, it drops DTR. When RTC needs to communicate with the TIU again, it raises DTR. If you use my interface design with the 3-state buffer, droping DTR makes the TIU think that you have unpluged the remote. This lets you use the wireless remote just as in normal operation. Look at Setup Screen.

5. The "Activate" button on the Accessory Screen has the same sticky problem as the horn (see note 1). I applied the same fix to this button.

6. I repaired a error in the RTC Recording/Playback code. Any recorded files that you previously recorded probably won't playback any more. Sorry.

V 0.0.2.61

1. I think I fixed the problem with the "sticky" Horn/Whistle button.

V 0.0.2.65

1. Added RTS to have the same functionality as DTR, that is, if the progam is idle for more than a few seconds, it will drop DTR and/or RTS (as selected on the setup screen). The dropped DTR/RTS can be used to disable the interface buffer chip so that the DCS Remote can control the TIU. When the progam needs the TIU again, it will automatically raise DTR/RTS. Suggested by an alpha tester.

2. The AIU control code had a bug in it which is fixed. The bug prevented the AIU from responding to the program. Uncovered by an alpha tester.

3. I made another attempt to fix the sticky button problem.

V 0.0.2.70

Interium version - never released

V 0.0.2.92

1. Each TIU now has its own list of engines. These are kept on five files on the disk named "EngineDataX.ini" where X is the TIU number, 1 to 5. If you used a previous version of RTC and want to keep the list of engines, you should rename the file EngineData.ini to EngineDataX.ini where X is the TIU number that you use. You can find this file in the same folder as where the RTC program itself is located.

2. As an extenion to #1, the RTC program now saves all of its information on a TIU by TIU basis. This means that you can start up two copies of RTC, set one to TIU 1 and the other to TIU 2, then set two different COM ports, use two USB to RS-232 adapters and cable up to two TIU. Actually, there is no reason that you can't use five copies of RTC and five adapters connected to five TIU.

To make this work, you have to tell RTC which TIU and which Remote number to use. I have added two command line parameters. If you create shortcuts on your desktop, set the "Target" of each one to something like:

E:\Projects\SerialTest\Remote_Control\Remote_Control.exe 1 15
E:\Projects\SerialTest\Remote_Control\Remote_Control.exe 2 14

where the first parameter is the TIU # and the second is the Remote #

You can then startup each one and select different COM ports and you are off.

3. An idea stolen from Mike Hewett and his Train Brain based program. Shows one window with up to 10 sets of controls. Each set contains only the basic functions but you can see the controls for up to 10 engines at the same time. You can select the engine number for each Engine. This does not work for LashUps yet but might sometime in the future. To access this feature, RTC must be connected to the TIU and then press the [Quick Ctrls] button. RTC will remember the engines that were selected. Settings are saved on a per TIU basis.

4. Added an option in Setup to keep old engines in the Engine List when the [Read] button is pushed. This lets you accumulate engines if you have more engines than fit on your layout. Suggested by an alpha tester. Engines are shown on the Engine List in normal font for active engines and in Italic and grayed for inactive (that is, not found by the previous "Read") engines. As another addition to this, when an engine is added to a LashUp, it is grayed in the Engine List. It returns to normal font when the LashUp is broken up.

V 0.0.2.99

1. Added state information to the saved Accessory/Switch data. RTC will remember the state of each Accessory/Switch between runs. When first started, RTC can't know the state so it assumes that accessories are OFF and switches are Straight.

You must delete any AccDataXX.ini files as the old format is not compatible with this change. Sorry

2. I added some color to the Accessory/Switch control screen so you can tell quickly the state of each device. I added a "Make it so" button which goes through all the devices listed and sets them to their saved state.

3. Another shot at the sticky button problem. This is probably as good as I will be able to get it within the limitation of the Borland C++ Builder environment. You have to press most buttons for at least about a quarter of a second in order for them not to stick. If they do stick, you can always unstick them by pressing them again for more than about a quarter of a second. This was a major rewrite of the handling of the sticky buttons. The problems occurs more on faster computers.

4. The max speed spinner was not working correctly. Fixed.

5. One of the alpha testers reported that sometimes the speed sent to the TIU does not match the value in the Speed Slider. He noticed that when he dragged the Speed Slider to zero but the engine kept on moving. This turned out to be another limitation of the Borland C++ Builder environment. The same problem as the sticky buttons - the event driven architecture of Windows causes a request to set 0 MPH to be sent before the request to set 1 MPH is complete. The 0 MPH request was lost. I redesigned the slider operation and now the problem will be much, much less frequent.

V 0.0.3.00

1. Radio support. Plug in the Infifuino with the CC1101radio connected to it. Drivers should load. Determine the COM port number that was assigned to the Infiduino. Start RTC, go to Setup, pick "Radio Support", select the appropriate COM port, press "Hide & Save". RTC should work just like a remote. You can select TIU's 1 to 5. You can switch between the TIU. You can startup and engine on TIU 1, then startup an engine on TIU 2 - you will have two Operations Windows controlling those two engines on their respective TIU. See this web page for more information.

2. I improved the look of some of the button Icons.

V0.0.3.1

1. An alpha tester requested that I add hot keys to open/switch to different Engine Operation screens. Now F1 through F10 will start the corresponding engine from the engine list or if its already started, will switch to its Operation screen.

2. I've expanded on those hotkeys. Look at the file Remote_Control.pdf for the complete list.

V0.0.3.2

1. "Auto Connect to TIU" setup option causes RTC to connect to the TIU automatically when the program is started.

2. Added option to use the minimum acceleration and deceleration rates for all engines and LashUps - "Use Acc/Dec = 1". I recommend that you always use this option. With this slowest acceleration/deceleration, the engines are close to real life but still aren't slow enough.

3. Added a "Mode Select" radio button box to the Setup screen. In this selector, you can select specific RTC support for the "Wired" or "Radio" interface to the TIU or for support for the "TIU Emulator".

4. Added a "Startup All" button to the main screen which, when pressed, will send a startup sequence to all "Active" engines in the Engine List that aren't already started. This will open an operations windows for the started engines. Enable this by checking the "Enable SU/SD All" checkbox on the Setup screen.

5. Added a "Shutdown All" button to the main screen which, when pressed, will send a shutdown sequence to all started up engines in the Engine List. It will close any open operations windows for the shutdown engines. Enable this by checking the "Enable SU/SD All" checkbox on the Setup screen.

6. Moved the Coors door open/close to buttons on the the Sound Controls screen. These buttons are always enabled because I don't know how to tell if the Coors train is running.

7. Added a "Mute" menu selection to the RTC main screen popup menu. This selection mutes all started engines. Selecting it, places a checkmark next to it. Selecting it again removes the checkmark and unmutes the engines.

V0.0.3.15

1. Changed the way that the COM port is selected. Now the RTC program will list the COM ports that it finds and you can just select the one you want. You can also just click the spinner to select the port. The COM port list also displays the "Friendly Name" if it can figure it out. You will probably have to choose the COM port the first time that you run this new version
of RTC.

2. Added Auto Labored Smoke handling to the Operations window (steam only). When "Labor Chuff" button is pressed, the engine's smoke level will be changed to maximum, when "Drift
Chuff" is selected, the smoke level will be changed to minumum. When both are turned off, the smoke level will be left unchanged.

3. In a similar manner as #2, added Auto Rev Exhaust handling to the Operations window (Diesel only). When "Rev Up" is selected the engine's exhuast level will be changed from minimum to medium to maximum as rev levels are increased from 1 to 9. In the same manner, the exhaust level will be lowered as "Rev Down"  is selected.

4. Cleaned up TX Only mode (a Debug only mode) to put a 100ms delay between each command. RTC was sending commands to the TIU faster than the TIU could process them.

5. RTC quietly ignores any TIU responses addressed to a different Remote number.

6. I changed the way the PFA button on the Operations window works. I never liked my original implementation. First, I added a new option on the Setup window "Automatic PFA Sequence".
A. if "Automatic PFA Sequence" is not checked, the sequence will start and you need to click the Direction button 4 times just like with the remote. You can press the PFA button again to cancel the sequence. Between the presses of the DIR button you can go off and run other engines.
B. if "Automatic PFA Sequence" is checked, the sequence will start and automatically send the Direction command 4 times spaced about 20 seconds apart. You can press the PFA button again to cancel the sequence. When this automatic sequence is running, you can go off and  run other engines.
C. The PFA button is green when the PFA is running.

7. Improved the performance of the "Radio" option on the Setup window. Now Port information is separately saved for radio mode (for wired mode, port information is already saved by TIU number).

8. Improved the operation of the "Activate" button on the AIU Accessory/Switch control window.

9. Added a right click popup menu on the Emergency Stop button to give you the option to just send Shutdown to all engines rather than killing the TIU power.

10. Added a Master Volume control on the Quick Controls window for each engine. The volume setting is saved between runs (as is the smoke switch setting).

11. From the main RTC window right click popup menu, I added an option to change the TIU number.

12. I added a new option to the Setup window : "Short Bell/Whistle Sequence". This option causes a shorter Bell/Whistle sequence when moving from 0 Smph. Suggested by Mike Hewett. This option leaves the Bell ringing after the sequence is complete and you must manually turn off the bell.

13. There is now a right click popup menu attached to the Bell switch on the Operations window. You can turn on the bell for 10, 20, or 30 seconds and it will automatically turn off at the end of that time.

14. Touchscreen note: The touchscreens that I have found don't handle "long presses" well. They seem to use "long press" to emulate a "right mouse click". I have found that if you roll your finger you can get the same effect as "long press". This affects the Whistle/Horn and Accessory Activate buttons on RTC. The other built-in problem with the touch window is the missing SHIFT, ALT and CTRL keys. Currently, RTC uses some of those keys for alternate actions when clicking a button. Over time, I will be adding popup menus to present those same alternate actions so eventually, those keys won't be needed.

15. The DCS Setup window now saves its settings by TIU number.

16. I made the selection of Middle Engines when creating a LashUp simpler. You can click on an engine then the ">" button repeatedlly to add engines. Click on the "<" button to clear the Middle Engine List and start over.

17. I further improved the "Critical Section" code which should reduce the problem of "sticky" buttons.

18. I improved how LashUp are created/edited. Sometimes, though, an engine will not get correctly marked as active/inactive. You can right click on the engine list on the Main screen and set any engine to active/inactive.

19. When LashUps are started, Smoke/Exhaust and Engine Type are set to values saved with the head engine.

20. I added an option on the Setup Screen to disable the Emergency Stop buttons. Use at your own risk!

21. I added a right click popup menu on the Whistle/Horn button. This feature is still experimental and may not work correctly. The problem is that the minimum duration whistle/horn is different for different engines.

V0.0.3.16

1. I added a Super TIU mode selection on the setup window. This is my best guess at how it works but it remains largely untested because my layout doesn't need it. Feedback appreciated. Debug Mode only. If you don't know to get into Debug Mode, contact me. I'll move this out of Debug mode once a few people use it.

2. I did some more testing and fixups on the code which allows the use of Engine #0 - the factory reset engine. You can control, rename and renumber factory reset engines. Debug Mode only. If you don't know to get into Debug Mode, contact me. I'll move this out of Debug mode once a few people use it.

3. I added the ability to create Routes and Scenes. They are not separate things as in the Remote but can contain both switches and accessories. Up to 256 can be created. Each can contain an unlimited number of switches and accessories (although only 500 (250 switches and 250 accessories) can be connected to the maximum 5 AIU on 5 TIU). They can be "Activated" to presets or "Reset" to defaults. Unlike the remote, you set an accessory to turn off when a Scene is activated.

The Route/Scene windows works in a similar manner to the LashUp Window.

Right Click on the Route/Scene window for Help.

4. I cleaned up the operation of the AIU Control window. Now double clicking on an accessory or switch will toggle the state of that device. The state is now shown with a cute Icon rather than words.

5. Added "All" Accessory and Switch operation to the AIU Control Screen. Turns On/Off all accessories connected to the TIU or sets all switches connected to the TIU to straight/closed or diverge/thrown. ALL switches and accessories connected all AIU connected to the selected TIU. Debug Mode only. If you don't know to get into Debug Mode, contact me. I'll move this out of Debug mode once a few people use it.

V0.0.3.17

1. The Engine List on the main window was acting odd and I finally found the cause and fixed it.

2. The little Icons that I used for Accessory and Switch states had a transparent mode which I forgot to set. Now their background is transparent.

3. On the AIU Control and the Create Route/Scene windows, I show the four possible state Icons as a "Legend". I wasn't very clear that they are not buttons. I added a Hint which pops up trying to explain what they mean.

v0.0.3.18 AKA v0.3.18.0

0. I changed the version numbering scheme because I find that I am sending out RTC to my alpha testers between releases. I need a way to distinquish these. This would have been v3.18 but I just moved the numbers one position to the left. So this is version 3.18.0. I will use the last digit position for intermediate releases.

1. On the Operations screen, the Boost and Brake buttons will increment/decrement the speed by 1 Smph if clicked. If held down, they will increment/decrement the speed by 1 Smph every second. I also made them a little larger so my aim on my touchscreen did not need to be so precise.

2. I spent the last week finally digging into the way that Engines report which hotkeys that they respond to. In response to an Interrogate command, the Engine reports back 80 bytes of data. 26 of those bytes indicate hotkeys based on bit position where there is a '1' bit. I was able, using the RTCEngineE Arduino program, to set all of those bits to '1' and feed them to a Remote. The Remote then listed all of the hotkeys when I pressed the "S4"/"more" button. I've been able to detect 70 hotkeys and the exact bit in the Interrogate command response that causes that hotkey to be displayed by the Remote. Once I could do that, I could just press the hotkey on the Remote and watch (again using RTCEngineE) exactly what command the Remote sent for that hotkey function.

Using what I learned, I modified the Operations and Sound Control Windows to show only controls for hotkey functions that are actually supported for each engine. So if the engine does not support the Grade Crossing Signal, for example, that button will not appear in the window.

This includes switches and buttons on the Operations Window for:
    Firebox Glow (LFB)
    Headlight (something different than the HDLT button on the Remote)
    Mars Light (LMA)
    Ditch Lights (LDI)
    Interior Light (LIN)
    Marker Lights (LMK)
    Beacon Light (LBE)
    Number Boards (LNB)
    Running Lights (LRL)
    Track Inspection Lights (LTI)
    Auxiliary Lights 1 (LA1)
    Auxiliary Lights 2 (LA2)
    Auxiliary Lights 3 (LA3)
    Crossing Signal (SXS)
    Pantograph Menu (MOP)


And on the Sound Control Window for:
    Coors Delivery (Start/Stop/Doors Open/Doors Close) (CDS, CDO, CDC)
    Boiler Startup/Pressure Release (FBS, FPR)
    Train Wreck (STW)
    Coupler Slack (SCS)
    Coupler Close (SCC)

If you want to understand the gruelling details of the hotkey encoding, on my web page, look for the file "Command ('Ixxx') Response.xls". I haven't completed this yet. Some of the hotkeys, like Engine and Idle Sounds, are not used by RTC so I haven't yet determined their exact bit position. I'll do it when I need it.

I'd appreciate feedback on how well this works. If you look at the hotkeys on a Remote, RTC should show the same set of hotkeys from the list above. Remember though, I don't have hotkeys for Engine Sounds or Idle Sounds and other hotkey functions are handled in the background by RTC.

RTC does not handle Doppler or Trolley functions. RTC does not yet handle the quillable whistle but I know the hotkey commands to do it. Let me know if you have an engine with such a whistle.

As an aside, in looking in detail at hotkeys, I can see a lot of erroneous hotkey information in the Engines. For example, I see many cases where a Marker Light hotkey is reported by the Engine but that Engine did not have any Marker Lights. I have a Doddlebug that reports a Pantograph Menu.

3. Hotkeys not tested because my engines don't have them:
    Beacon Light
    Running Lights
    Firebox Glow
    Mars Light
    Auxilary Lights
    Pantograph
    Coors Delivery
    Boiler Startup/Release

4. On the Operations Window, I deleted the "LIN Light" switch as it now is handed by the hotkey code. I added a "Sounds" switch which will mute the engine sounds.

5. Generally cleaned up a lot of labels and Hints.

6. I realized that if communications fails while playing back a saved recording, I needed to do something drastic. So now if comm fails (after the set number of retries), RTC will send an Emergency Stop to all TIU's.

7. Dumb typing mistake in the LashUp window code prevented start up of a good LashUp.

8. I generally made buttons bigger where I could mostly to help when using a touchscreen.

9. Rule 17 lighting - almost. My P&LE GP-7 #1501 (PS3) headlight dims when it is stopped. A nice feature not even listed on the MTH webpage (but the webpage advertises lighted marker lights and there are none). I've added a setup option to RTC which automatically turns off the headlight when your engines are stopped. Not exactly correct but its there if you want to use it. Defaults to off, if set, it applies to all engines.

v 0.3.19.0

0. This is mostly a maintenance release where I created one set of source code which would compile under BCB4.0 (my orginal IDE) and CB10.1 (the lastest IDE from Embarcadero).  Thanks to the Kevin Rice for leading the way on this.

1. I added a debug mode for the Engine Sound Knob. Now in debug mode, you can explore all of the 255 values for this knob and see what sounds come out. In particular, starting at engine sound 80 are the clips for PFA.

Some of the engine sounds cause a continuous repeat of the sound. When that happens, other sounds will not play. I don't know how to turn this off other than pressing the "Whistle/Horn" button.

Note: in non debug mode, the Engine Sounds Knob sends commands that correspond with the Engine Sounds as listed on the hotkeys. When sound 1 is selected, the command "n177" is sent and so on. In debug mode the knob setting is sent unchanged to TIU. If sound 1 is selected in debug mode, "n1" is sent to the TIU. The sound number corresponds to the index used by the ADPCM program.

2. Changed the Rule 17 lighting to be by engine rather than to apply to all engines. It now also turns off the interior light when the engine starts moving. I added a switch to the Operations screen.

v 0.3.20.0

1. Added Hot Buttons:

    The big addition are Hot Buttons. This is a window of 20 buttons that you can program to perform most any operation, on any engine, on any TIU or AIU. So if there are functions that you do over and over, on any TIU or to any engine, you can setup this window to do that function with one click of a button. You can popup this window and keep it on the screen to use as needed.

    Up to 20 Hot Buttons can be defined. Once defined, a click on the button will immediately send that command. To open the Hot Buttons Window, click on the [Hot Buttons] button on the Main screen.

    To edit a button, right click on that button. Fill in the fields:
        - Button Label that will appear on the Hot Buttons Window. Use "&&" for "&", ie "P&&LE".
        - Command to be executed selected from the drop down Command List
        - TIU Number 1-5
        - Engine/Lashup Number: Engines 1-99, All Engine Operation 100, or LashUp 101
        - for AIU commands, the AIU Number 1-5 and the Port Number 1-10
        - for LashUps, the LashUp String - engine numbers separated by commas, using a minus sign to indicate Reverse Running.
        - for engine sounds, enter the sound number 1-255

Press the [OK] button to accept that command.

To undefine a button, right click on it, press [Clear] and then press [OK].

A special function "Playback of a Recorded File" lets you associate a recorded file with a hot button. When you press the button, the recorded file will play. You can cancel playback by pressing the [Cancel] button on the playback popup. You can repeat the playback by checking [X]Repeat.

The program, internally, maintains the Command list. If you want to add a command, right click the Hot Buttons Window outside of the Hot Buttons themselves and select "Edit Command List". Each line in this list is a command. The format is "Command Description"="Command". Press [Done] to save the edited list. The edited list is saved in the RTC folder with the name "HotCommands.txt". You can delete this file at any time to return to the internally maintained list.

A setup option "[X]Auto Hot Buttons" causes RTC to display the Hot Buttons window automatically each time the program starts.

2. Moved position of Quick Controls button

3. The buttons for Startup All Active Engines and Shutdown All Engines have  been removed. To perform these functions, right click on the Main Window and when you get the popup menu, you can select these functions.

4. In the setup, you can select [X]Allow 255 Sounds. This sets the Engine Sound knob on the Sound Controls window to show sounds 1-255 on the knob. With this, you can play all 255 sounds in the engine. On the remote, "S01" hot key selects sound 177, "S02" selects sound 178 and so on. The 1-255 number corresponds to the index into the sound file as shown by the ADPCM program. http://www.silogic.com/trains/ADPCM.html

4a. For touch screen users, I added up/down buttons to both the Engine and Idle Sounds knobs. With a touch screen, the knobs are too hard to accurately control. The knobs themselves may disappear someday.

5. Totally rewrote the recorded file playback routine. Now when you select a recorded file for playback from either the Setup window or the Hot Buttons window, the playback runs as a separate thread. That means you can do other operations or even other playbacks while the playback is running.

V 0.3.21.0

1. Hot buttons would not work if you had no AIU, ouch.

2. Bug fixes in Quick Controls. Enhancements in Quick Controls.

3. General code cleanup and communications speed up.

4. General improvement in how Conventional Mode works. RTC now puts the channel into Variable mode when you select the [VarX] button.

5. Added a button on the operations screen that causes the bell to sound with the Horn/Whistle and with the Crossing Sound. The setting of this button is saved.

Now this button and 3 others have been relocated on the operations screen:
    Rule 17 Lighting - turns off the headlight when stopped
    Ring Bell w/Horn - causes the bell to sound with the Horn/Whistle and with the Crossing Sound
    Auto Bell/Whistle - relocated from a switch. Sounds the horn/whistle when engine is starting moving from a dead stop
    Auto Labored Smoke/Auto Rev Exhaust - For steam engines, increases smoke output when laboring.
                For diesel engines, increases exhaust output when Revs are increased.

The settings of these 4 switches are saved with the engine.

6. Super TIU Mode operation improved. Setting screen added from "Super TIU Mode" button on Setup window.

7. Added the ability to increase the size of the Quick Controls window. It also increases the size of all of the buttons and controls for easier touch screen use. The size can be set to 1.0, 1.1, ... 2.0 of the normal size.

V 0.3.22.0

1. I found the Hot Buttons to be so useful that I added 4 more windows of them so their total is now 100. Right click on [Hot Buttons] to bring up a popup menu where you can select from the 5 windows. Left click on [Hot Buttons] brings up buttons 1-20 just as before.

2. Added support for Alternate Sound, SAH. This button, on the operations window, plays sound 243. If the engine supports the SAH button, it will appear automatically on the operations window when the engine is started up.

3. Yet another attempt to fix the sticky buttons problem. In the Windows message based execution environment, I delayed the processing of the mouse button up message until after the mouse button down message processing is complete.

V 0.3.23.0

1. From the Operations screen, I added two menu items:

    1. Engine Information - Interrogates the engine and displays these four pieces of information:
        1. Odometer (Smiles)
        2. Trip Odometer (Smiles)
        3. Track Voltage (volts)
        4. Chronometer (hours:minutes:seconds)
    My interpretation of these values may be slightly different than that of the Remote.

    The interrogation of the engine is done once automatically when this screen is first opened. If you wish to repeat the function, select the update interval the press [Start]. Press [Stop] or [Hide] to stop the updates.

    This function sends a lot of packets between the program and the TIU. Its probably not a good idea to leave it running.
 
    2. Track Signal - Interrogates the engine once each update interval and displays the number of packets out of 100 that engine correctly receives. Also displays the average packets received out of each 100. Update interval can be changed. Press the [Start] button to start, the [Stop] button to  stop. Hiding the screen also stops the function. Unlike the Track Signal function on the remote, this function shows you exactly the number of packets received correctly by the engine from the TIU.

    This function mutes the engine while it is running.

2. If you right click on the [HeadLight] button of the operations screen, you can select one of two menu items:

    1. All Lights Off
    2. All Lights On

    Turns off/on the headlight, marker lights, beacon light, interior light, running lights, number boards, ditch lights, mars light, firebox glow, track inspection and Aux lights.

3. From the Engine List popup menu on the main screen, you can also select the Engine Information as described above in item 1-1.

4. Added an option on the Setup window "[X] Auto Quick Controls". If you check this, the Quick Controls window for the TIU is automatically displayed as soon as you connect up to a TIU by pressing the [Connect] button.

5. Again to make the use of touch screens a little easier, I increased the size of the UP/DOWN buttons on these 3 windows bigger to make it easier to touch the button. I removed the vertical scroll bar.

    Engine List on the Main window
    Lash Up List on the Lash Up window
    Route/Scene List on the Route/Scene window

You can still use the up/down arrow and PgUp and PgDn keys to move through the lists. I added an menu item on the right click popup menu to temporarily restore the scrollbar if you need it.

6. If "Auto Bell/Whistle Sounds" is selected in the Setup window, the engine will blow one short horn/whistle when running and the [STOP] button is pressed.

7. Added support for Proto Whistle (SPW), Smoke Whistle (FSW), and Swinging Bell (FSB). Smoke Whistle and Swinging Bell are toggle switches that appear if the engine supports those functions. If the engine supports Proto Whistle, a toggle switch will appear, which, if turned on, will display a slider. Drag the slider from 0 to sound the quillable proto whistle. Turn off the toggle when you are done as the normal whistle sounds are not available when this function is turned on.

Unlike the Remote, you can have the Quilling Whistle slider and Speed slider on the screen at the same time.

V 0.3.24.0 to 0.3.26.0

Internal releases only.

V 0.3.27.0
As of V0.3.27, I recommend that you upgrade all of your Remotes and TIUs to DCS v6.xx. MTH made some dramatic changes to the command format with v6.xx and TIU with that version will not accept all commands from a Remote running the older DCS versions. At the very minumum, you can still use v5.xx but be certain that all TIUs and all Remotes are loaded with that version.


1. Major changes to the underlying structure of the RTC program. The goal was to make the communications between the PC and TIU more reliable. I rewrote the communications system to use threads and thread-safe lists. This is a lot of technical mumbo-jumbo but basically, there needed to be one routine in the program which does the communications with the TIU. There always was just one in the earlier versions but because of how Borland/Embarcadero coded their user interface, it was possible for that one routine to re-entered.  To the user, the changes are invisible, all of them occuring deep within the program. It all sounds so simple but the changes took me several months as I had never worked with threads before.

2. I added code to support the RFID train detection hardware that I describe on this page.

3. I added the ability to code a routine (named Program_Control.cpp) which can control trains without human interaction using train detection information provided by the RFID hardware.

4. I forgot a "Speed" command in the Hot Buttons list. I've added it

5. I finally realized that the DCS command sequence for Lash Ups changed dramatically from DCS 5.xx ot DCS 6.xx. In the older version, the engines in the Lash Up were encoded as binary numbers in the command. In the newer version, the engines are sent as plain ASCII. I could guess that this was done for better interface with the WIU. I updated RTC to use the TIU version number to determine if it should send the old version or the new version of the Lash Up commands. See the note at the beginning of this section.

6. The [Connect] buttton when now show the TIU version number when RTC is connected to a TIU.

7. Some details about LashUps: When using the Remote, many engine soft keys available with engines in the LashUp are NOT available when running the engines in the LashUp. RTC sets its buttons and switches based on the soft keys in the head/lead engine so all possible functions are available. Examples of soft keys not available when using the Remote but available in RTC are: SXS (crossing sound), LMK (marker lights), and LNB (numberboard lights). Other less used functions which are available with RTC include DOD, DCH, FCC, DTO, DTV and FTS.

8. I improved the icons on the SFS and SRS buttons to show that they generate 2 toots and 3 toots of the horn/whistle respectively.

 V 0.4.0.0

V4.0 is a complete rewrite of the structure of the RTC program. I now use threads and thread-safe queues extensively and because of that the program is much more stable. Because of these upgrades to the program, Windows XP is no longer supported.

1. The major functional change is added support for the Lua scripting language so that anyone can write a script to control their trains. Look for the button [Prog Ctrl] or Program Control. This scripting facility, described on the  RTC Control Language - Scripting page works both standalone and with my RFID Train Detection.

2. Changed the terminology used for the AIU switch positions. I now use Closed or Thrown rather than Straight or Diverge. Both sets of words
are acceptable.

3. Added several new windows accessable from the Engine List popup menu and the Operations Window popup menu:

    Engine Information - displays DOD DTO DCH and DTV
    Engine Status - displays actual engine speed, instantaneous engine speed, status of various lights/features and DTO
    Track Signal - Sends FTS "Pings" to the engine and reports success rate

 V 0.4.1.0
  1. Added internet (http/ftp/smtp etc) support using the luasocket package version 3.0-rc1 written by Diego Nehab and OpenSSL-Win32-1.0.2s. To use this feature, the folders 'ssl', 'lua', 'socket' and 'mime' should be present in the same folder that contains the program executable (Remote_Control.exe). Some of these files have been modified by me to work correctly in the RTC running environment.
    1. Diego writes:
          This is the LuaSocket 3.0-rc1. It has been tested on Windows 7, Mac OS X,and Linux.
          Please use the project page at GitHub https://github.com/diegonehab/luasocket
          to file bug reports or propose changes.
          Have fun, Diego Nehab.
      Because of the limitation of LuaSocket 3.0-rc1 to running only on Windows 7 and newer, the normal distribution of RTC will not run under Window XP.
       
    2. The OpenSSL team writes:

      The OpenSSL Project is a collaborative effort to develop a robust,  commercial-grade, fully featured, and Open Source toolkit implementing the  Secure Sockets Layer (SSLv3) and Transport Layer Security (TLS) protocols as  well as a full-strength general purpose cryptograpic library. The project is  managed by a worldwide community of volunteers that use the Internet to  communicate, plan, and develop the OpenSSL toolkit and its related  documentation.

      OpenSSL is descended from the SSLeay library developed by Eric A. Young  and Tim J. Hudson.  The OpenSSL toolkit is licensed under a dual-license (the OpenSSL license plus the SSLeay license), which means that you are free to  get and use it for commercial and non-commercial purposes as long as you  fulfill the conditions of both licenses.
  2. Because of the limitation of LuaSocket 3.0-rc1 to running only on Windows 7 and newer, the standard distribution of RTC will no longer run under Windows XP. If you need a versionof RTC which will run on Windows XP, contact me.
  3. On the Program Control screen, if you right click on the script file name, RTC will display a pop up menu. From this menu, RTC will attempt to run an editor so you can edit the script file or you may remove the script file from the dropdown list. Editors are checked in this order: NotePad++, Metapad, Notepad, and Wordpad. An error is displayed if RTC can't find any of these editors.
  4. Corrected an error in the InputBox() function with Lua scripts.
  5. I did more research on the DTO(), DCH() and DOD() function calls from Lua scripts. I updated the code to more correctly return the odometer mileage and time information.
  6. Add support for multiple Program Control windows. Up to 5. This will let you run up to 5 independent Lua scripts at the same time. Look at the web page titled "RTC Control Language - Scripting" for details.
  7. Changed how the global Debug value is accessed in the Program Control window. Previously it was passed an argument to all functions. Now it is accessed by calling the function "Debug()". That function will return a integer value between 0 (no debug messages) to 9 (full debug messages). This new method allows your Lua script to respond better to changes in the value of the global Debug variable.
V0.4.2.0

1. Cleanup for the Program Control functions. Fixed some bugs. Extended Beep() and Counter() script commands.

2. Added dropdown menus on some of the buttons which duplicate the right mouse button popup menus.

3. Added a Detected RFID Tags window which is automatically displayed when the Program Control button is pushed. This displays all of the unique tags which have been detected by the tag readers. If you left click on any tag, a partial decoding of that tag is displayed at the bottom of the window.

4. You can run the lua interpreter in standalone mode by pressing the [Interpreter] button or whenever a script is run. In the input line below the Messages window, you type any lua command as long as it all fits on one line.

   You can type expressions or statements. An expression does not save its result. The program will just print out its result.

   For example  "3+5"   will print out "8".

   A statment is a complete lua command.

   For example  "a=5"   will create a variable called "a" and store the value 5 in it. Then "print(a)"  will print out "5".

   If you are running a script, you can reference the variables in that script.

   For example, if you have a variable "Engine" in your script and you want to check its value while your script is running, "print(Engine)" will display the engine number. You can be fancy and use "print("Engine Number is ", Engine)" which will print "Engine Number is 6". Making use of the Debug() function described in item 7 of the 4.1 release, you can type "print(Debug())" and the program will print the debug level.

V0.4.2.1

1. Editing the Engine Name changed to use the Engine Name field in place rather than a separate popup window.

2. Program Control scripting expanded to handle all of the response packets that can be returned by the RFID detectors. Added were:

    a. uidtag()
    b. nametag()
    c. response()

    Look at the "Control Language - Scripting" web page for details.
    http://www.silogic.com/trains/RTC_Control_Language.html

3. The Detected RFID Tags window was extended to show the UID only (or unprogammed) tags. Select between the tag types using the tabs above the Detected Tags window.

4. Added a configuration file that lets you change the wording of switch track positions on various windows. The program uses "Normal" and "Reverse" as defaults. You can change the two words to anything you like, eg "Closed" and "Open" or "Closed" and "Thrown". These word changes are visible on the AIU Control window and the Hot Buttons window.

5. Added dropdown menus on some buttons. These menus are the same menus that previously could be accessed by right-clicking on the buttons. Buttons affected are:

    a. [Startup]
    b. [AIU Control]
    c. [Prog Ctrl]
    d. [Hot Buttons]
    e. [Read]
    f. [Sount Ctrls] (on the Operations window)
    g. [Browse] (on the Program Control window)

6. Added three functions to the scripting language to fetch car/engine information based on the contents of a detected Tag:

    a. GetRailroadName()
    b. GetEngineName()
    c. GetCarName()

    Look at the "Control Language - Scripting" web page for details.
    http://www.silogic.com/trains/RTC_Control_Language.html

    Includes three files on the disk which are used to extend the information:

    char CarModelsFileName[] = "CarModels.txt";
    char EngineModelsFileName[] = "EngineModels.txt";
    char RailroadNamesFileName[] = "RailroadNames.txt";

    These files are names in plain text. You can add your preferred values to the files and they will be used by both RTC and the Tag Programmer.

7. On the Quick Controls window, I made the actual Engine Number appear at the top of each control in large bold font so that it would be easier to see. Requsted by Mike Hewett.

8. These windows now have [Prev] and [Next] buttons to quickly move between windows:

    a. Hot Buttons (moves between 5 windows of 20 hot buttons each)
    b. Program Control (moves between 5 windows each running a script)
    c. AIU Control (moves between the 5 AIU's allowed on each TIU)

V0.4.2.2

1. When you run the Program Control windows, the list of Detected Tags does not show automatically. If you want to see the Detected Tags, press the [Show Tags] button on the Program Control window. The RFID system must be enabled on the Setup window of course.

2. In the Program Control section of the program, I added a new function named event(). This function can be called by the SetEvent() function from any PC window. Look at the on-line documentation for details. These two functions are used to let scripts running in different PC windows to communicate with each other.

3. A few bug fixes in the Quick Controls window including better handling of the engine sound level setting when Starting an engine from that window. Sound level change requested by Mike Hewett.

V0.4.3.0

1. Increased the number of buttons on the Program Control window from 10 to 30. I found that I needed more than 10 for more complicated scripts. So as to not increase the size of the window, the buttons appear on three tabs of 10 buttons each. Look at "FunctionTest.lua" to see how to change the words on the buttons and on the tab labels.

2. Increased the number of Program Control windows from 5 to 10.

3. Added the "Add Engine" function. Right click on the [Read] button to get the popup menu. Select "Add Engine(s)". The program will search for all Factory Reset engines and present them to you one at a time. Select the new engine number for each engine and press [OK]. Previously you had to perform this function with a Remote.

4. Addition to the Program Control language of global integers and strings to permit communications between scripts running in different Program Control Windows.

    Look at the RTC Control Language - Scripting page for details on how to use these.

5. Added Layout window and functions to support that window.

    Look at the RTC Control Language - Signaling page for details on how to use this.

V0.4.3.1 (not released)

1. Quick Controls now supports All Engine operation (Engine 100) and Lashups (1-20 selected as 101-120 in the spinner).

2. Added support for the Adafruit Feather 32U4 RFM69HCW Packet Radio 915 MHz. A new Setup option "[x]DTR Always On" must be checked in order for RTC work correctly with this radio. Arduino sketch for RTCModemF is available on the RTC web page.

V0.4.4.1 (not released)

1. Support for the Adafruit Feather 32U4 did not work correctly. Connection to the TIU was intermittant. The problem was how the 32U4 implimented the USB port. It is very different than other Arduinos. I had to change the code in RTC to give the USB port time to intialize after RTC raised DTR.

V0.4.4.5 Beta Test Release of V4.5.0

V0.4.4.6 Beta Test Release of V4.5.0

V0.4.9.9 Internal and Testing Release Only --->  will become V0.5.0.0

The major change for V5 of RTC will be WTIU and RFID support over WiFi. Now it is no longer necessary to use a USB based CC1101E radio for the TIU connection or to use physical USB or serial cables for the RFID tag detection circuits.  RTC supports both the WIU & TIU combination and the soon to be released WTIU. I've written an ESP8266 version of my RFID tag detectors which supports WiFi. Select the device on the Setup window. Look on this web page for setup instructions:  WiFi Support for RTC . Major internal changes to the program but other than setup, operation is the same.

Other enhancements and bug fixes:

1. Add a window to display Signal aspects on a bitmap of your layout. I added 10 new PC Control Language functions to support Signals. I also added "Cab Signals" which reflect the home and distant signal aspects -- just like the big guys. Read about it on this web page:  RTC Control Language - Signaling .

2. Replaced the concept of "Run Time" in the Program Control window with "Elapsed Time". This counter measures the elapsed time from when the [Run Script] button is pushed until the Lua script stops (either on it's own or by a press of the [STOP] button. The time will increment and turn green when the script is running and will stop incrementing and turn red while the script is stopped.

3. In conjunction with item 2, the RunTime() function as been changed to return the number of seconds since the first Program Control window was opened. RunTime() will return the same value to all Program Control windows if it is called at the same time. (This is different than the previous operation which returned the run time of each individual Lua script.) With this you can compare time of operations between different PC windows.

4. Fixed a bug that prevented some Lashups, created with the Lashup window, from being saved correctly.

5. Embarassingly, there was a serious bug in the Quick Control window's support for Lashups. Hopefully, I've fixed it in this version.

6. The speed was not set correctly from the Operations window in the case of the speed going from 0 to 1 Smph with Auto Bell set.

7. The AIU Control Window now has a bitton to open the next or previous TIU. It already had buttons for the next or previous AIU.

8. The Debug Messages Window now has an AutoScroll check box. If this box is checked, the end of the messages (the previous mode of operation). If the check box is cleared, the window can be scrolled up or down manually.

9. The Debug Window now has a TimeStamp checkbox. If this box is checked, each message is prepended with the time it was processed. Because of the way that RTC handles these messages as lowest priority, the messages may appear out of order.

10. The Debug Window now has a line count display.

11. Added and improved the use of Lashups on the Quick Controls window. Lashups appear as engine numbers 101 to 120. These correspond to Lashups 1 to 20.

12. The Layout window has two new buttons, [Layout Copy] and [Window Copy]. The first attempts to copy the entire layout window to the Clipboard. This may not work as desired when the layout itself is too large to fit on the screen. The second copies only the part of the layout actually displayed to the Clipboard.

13. Had a lot of comments about the blowing of the whistle and ringing of the bell when an engine is started from 0 Smph. This was controlled on the Setup Window by one option [X] Auto Bell/Whistle Sounds. I broke this up into two options:

     [X] Auto Bell : if set, this option causes the RTC program to ring the bell automatically when starting from 0 Smph. This option applies to all engines but on each engine's Operation Window, there is a corresponding LED, ¤ Auto Bell, to disable this feature for that particular engine. Click on the LED to change it from Red (disabled) to Green (enabled).

     [X] Auto Horn/Whistle : if set, this option causes the RTC program to sound the whistle/horn automatically when starting from 0 Smph.This option applies to all engines but on each engine's Operation Window, there is a corresponding LED, ¤ Auto Horn/Whistle, to disable this feature for that particular engine. Click on the LED to change it from Red (disabled) to Green (enabled).

14. I also had a request to add an option to turn off the bell automatically after 5 seconds. I added a option on the Setup Window. If [X] Auto Bell Off is checked, the bell will turn off automatically after 5 seconds. If it is not checked, you must manually turn off the bell. For the Auto Bell Off feature, I add a spinner so you can set the automatic off time to any value between 1 and 60 seconds.

15. I added a new function to the RTC Control Language "InputDropDown()". This function makes it easier to request the user to choose an item from a list.

16. In the Program Control Window, the button font changes to Bold when pressed.

17. I added the ability for RTC to play some engine/environment sounds automatically. Right now, the only sound support is a relay clicking sound when the aspect of a signal changes. This feature is enabled in the Setup Window by the [X] AutoSound Controls check box.

18. Added a "No Sleep" option to the Setup window which prevents the PC from sleeping when RTC is running.

19. The Track Signal window now shows a bar graph of the pings returned from the engine under test. This better enables you to visualize the track condition.


V0.5.0.0 coming soon!

The program is out to beta testers.


You can learn about the RTC program on this web page:
http://www.silogic.com/trains/RTC_Running.html

Complete details and documentation for the Program Control windows are on this page:
http://www.silogic.com/trains/RTC_Control_Language.html

Hint #1  - If you click on "RTC Info" from the main window popup menu and then click on the "Hide" button, that annoying copyright window on startup won't appear any more.

Hint #2 - I refererence Debug mode several times on this page. It's never been "secret" and I've always told anyone who asked about it. I thought now, I should just write up here how to get into Debug mode. First - Its operation is not documented. Use at your own risk. If you do have questions about it, I will answer them. You can get into Debug mode two ways as follows: 1) press Ctrl-Shift-D from the main window or 2) move your mouse just to the right of the [STOP ALL] button. You should see a popup hint of just an exclamation mark "!". There is an invisible button there, double click on it. The most useful part of this mode is the "Debug Messages" window. You can set the debug level from 0 to 9 (3 is a resonable value), each level displaying more debug information. If you are having trouble with RTC, I may ask you to run RTC with debug level set and then ask that you [Copy All] messages to the clipboard and paste them into a email to me. You get out of Debug mode by pressing the [Hide] button on the Debug window.

Something to watch out for on the Debug window:  Because of the Windows messaging system, Results of a command may appear in the Debug messages window before the command itself. It's a good idea to turn on timestamping in the upper right of the window and look at the time to understand what happened first.


 Engine RAM Mapping

I have been able to partially figure out the RAM memory in each engine. This was all done by sending commands to the TIU and examining the responses. As I had stated before and as appears on my web pages: “I figured this out just by looking at the RS-232 stream over the radio. No code disassembly, no logic analyzers, no opening up of Remotes or TIU's. ” Eric Linz gave me some ideas when it came to decoding the responses from the DOD, DCH and DTO commands.

As I saw when working on the Sound File with my ADPCM program, multi-byte data in the RAM is stored big-endian This means that in multi-byte data, the lowest address contains the most significant byte of the data.

You can download my documentation for this mapping here - Engine RAM Mapping.pdf.

This document describes the 'q' or query command which is used to access the RAM -  QUERY command uses.rtf.


Radio Interface between the TIU and the PC:

Look here for a preview. I will have the writeup about the technical details of the radio on this web page.


About my Borland C++ Builder v4.0 IDE

RTC was initially developed with a program that was released when Windows 98 was current. The IDE is Borland C++ Builder v4.0. I've used it on Windows XP, Windows 7 and Windows 10 with success. You can still find copies on eBay.  I recommend that you do not use this older version of Borland C++ Builder but use the latest version 10.X -- see the next section.

The IDE is designed to be expanded with 'components'. These components can be visual (like buttons) or non-visual (some code that performs a function). The RTC program uses:

 Components that I wrote and which you will have to install in the IDE:
 HideButton - implements the functionality of the [Hide] button. <download ZIP file>
 QuitButton - implements the functionality of the [Quit] button. <download ZIP file>
 ColorButton - implements the funtionality of the standard button but in color. <download ZIP file>
 SyncListBox - implements the functionality of synchronizing the reverse running check box (TCheckListBox) on the LashUp window. <download ZIP file>
           
 Components that I bought:
 Abakus VCL - v6.00 build 8 - implements the functionality of the speed slider, toggle switches and other controls.

 RTC Version 4.3.0 source code 14 Dec 2020  for Borland C++ Builder v4.0 is no longer generally available. I don't recommend that you use the older Borland C++ Builder 4.0 code. Use the C++ Builder 10.1 code from just a little further down on this page. If you really want this code, send me an email.

My RTC source code is released under the  GNU General Public License Version 3 and GNU Free Documentation License Version 1.3. 

You will have to buy Borland C++ Builder v4.0 (eBay??) and Abakus VCL to compile this code.


About my Embarcadero C++ Builder v10.1 IDE

With the help of Kevin Rice, who first ported RTC to use the lastest C++ Builder IDE and Abakus releases, I was able to edit the RTC source code so that one set of source files would compile under both the old and new IDEs. Borland became Imprise and then became Embarcadaro. Embarcadaro is still around and sells a modern version of this IDE (C++ Builder). Keven ported RTC to C++ Builder 10.1 They have newer versions now of the IDE which I have not tried.

The IDE is designed to be expanded with 'components'. These components can be visual (like buttons) or non-visual (some code that performs a function). The RTC program uses:

 Components that I wrote and which you will have to install in the IDE:
 HideButton - implements the functionality of the [Hide] button. <download ZIP file>
 QuitButton - implements the functionality of the [Quit] button. <download ZIP file>
 ColorButton - implements the funtionality of the standard button but in color. <download ZIP file>
 SyncListBox - implements the functionality of synchronizing the reverse running check box (TCheckListBox) on the LashUp window. <download ZIP file>
LED3P - implements the functionality of a 3 head Signal. <download ZIP file>

Free Components that I downloaded from the Internet to support WiFi and the ESP8266:   
        ICS - Internet Component Suite - v8 - Delphi 7 to RAD Studio 11.0 by Francois Piette, http://www.overbyte.eu/frame_index.html   <download ZIP file>
                    See the installation notes below
        OpenSSL v3.0.5 Win32 for ICS, by Francois Piette, http://www.overbyte.eu/frame_index.html    <download ZIP file>

 Components that I bought:
 Abakus VCL - v8.00 build 9 - implements the functionality of the speed slider, toggle switches and other controls.

 RTC Version 4.5.0 source code 30 Mar 2023 for Embarcadero C++ Builder v10.1 is available here <download ZIP file>.

My RTC source code is released under the GNU General Public License Version 3 and GNU Free Documentation License Version 1.3.

You will have to download Embarcadero C++ Builder v10.1 Community Edition (go to their web page and click on "Free Tools" - the Community Edition is FREE!) and Abakus VCL v8.00 build 9 to compile this code.

Embarcadero has released version 10.4 and is moving into version 11 now. Version 10.1 may not be available anymore. I have not used the newer versions (I still use version 10.1) but RTC should compile and run just fine using it. Be sure the version of the Abakus VCL you buy, supports your compiler version.


Note about Installing the Internet Component Suite (ICS) v8 and OpenSSL v3.0.5

1. The files all indicate version 8.6.9 but when registered in CB10.1, it shows up as version 8.7.0

2. There are no install files for CB10.1 so I used the install file for CB10.2 : CB102InstallVclFmx.groupproj

3. I had to modify one file to get it to compile:  .\Packages\IcsVclCB102Run.cpp .  Here is the file as modified:

//---------------------------------------------------------------------------

#include <System.hpp>
#pragma hdrstop

USEFORMNS("..\Source\OverbyteIcsTnOptFrm.pas", Overbyteicstnoptfrm, OptForm);
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------

//   Package source.
//---------------------------------------------------------------------------
#ifdef _WIN64
  #pragma link "cryptui.a"
  #pragma link "crypt32.a"
  #pragma link "ncrypt.a"               // MCD
  #pragma link "IcsCommonCB102Run.a"
#else
  #pragma link "cryptui.lib"
  #pragma link "crypt32.lib"
  #pragma link "ncrypt.lib"                // MCD
  #pragma link "IcsCommonCB102Run.lib"
#endif

#pragma argsused
extern "C" int _libmain(unsigned long reason)
{
    return 1;
}


RTC on a Mac!

From:    John DeSanto <jdesa22gmail.com>
Subject:    Re: RTC V5 
Date sent:    Mon, 4 Mar 2024 17:13:13 -0500

Mark et al.
 
Update: I had some good results running this on a Mac using Parallels!!!
 
Here’s what I had to do to make it work:
 
Emulate WiFi - after running windows 10 vm, install a usb adapter and configure it to use Windows, not Mac. (By default the vm have a virtual bound interface that looked like a NIC card only)
 
Run RTC setup
Select NIC  - IP from windows
Run search
Found WIU
Built Lashup

Controlled from sub window on MacBook (yay!!)

Used extended features to control smoke volume, labored smoke auto, etc (all working great)
 



I used Embarcadero C++ Builder v10.1 Berlin to compile the program (newer versions may be available and should work fine).

Screen recording performed with CamStudio. and with Icecream Screen Recorder.

This site prepared and maintained by Mark DiVecchio

email :  markd@silogic.com

SD&A HOME
 
 Mark's Home Page

The DiVecchio genealogy home page
The Frazzini genealogy home page

This site will be under construction for a while.