EX-FastClock

Controlling EX-RAIL by Time

Suitable For Level: Propeller Beanie Engineer Hat

Time Command

The additional commands added to EX‑RAIL allow events to be controlled by the clock. The basic form of the new clock command is:

ONCLOCKTIME( hour, mins)

This is an event based command and will activate a sequence of commands until a DONE command is reached. An example of how this might be used is as follows:

ONCLOCKTIME(06,15)
  SETLOCO(7309)
  ....
  .... Do some stuff
  ....
  DONE

Sequences built this way can only be run via a clock command. If it was required to have a sequence that could be run for Engine Driver for example, then this could be operated by a clock command as below:

ONCLOCKTIME(06,15) SENDLOCO(7309,10) DONE

SEQUENCE(10)
    PRINT("Go Somewhere")
    FON(1)
    DELAY(500)
    FWD(50)
    DELAY(20000)
    FWD(0)
    DELAY(2000)
    FON(4)
    DELAY(3000)
    FOFF(4)
    PRINT("You have arrived")
    FOFF(1)
DONE

This event could either be run by the clock or could be selected at will from Engine Driver. To stop the EX‑CommandStation from running timed commands to switch to manual running, simply pause the clock.

Repeating Time events

Some users may wish to repeat an event at the same time every hour - e.g. to play a recording of a clock chime. It is possible to achieve this as follows:

ONCLOCKMINS( mins )

This is an event based command that will activate at the same time each hour as in the example below:

ONCLOCKMINS(15)

  SET(1000)             // Start playing first MP3 file
  AT(-1000)             // Wait for playing to finish

  RESET(1000)           // Stop player
  ....
  .... Do some other stuff
  ....
  DONE

The sequence above will repeat at 15 munites past the hour per FastClock time. It would also be possible to make these routines be selectable from Engine Driver by configuring them as follows:

ONCLOCKMINS(15) FOLLOW(10) DONE

SEQUENCE(10)
  SET(1000)             // Start playing first MP3 file
  AT(-1000)             // Wait for playing to finish

  RESET(1000)           // Stop player
  ....
  .... Do some other stuff
  ....
DONE

In that way the Sequence 10 can either be run by the clock, or if the clock is not running may be selected manually from Engine Driver.

NB: See the following page for details on running sound files.

I/O Device Drivers and HAL

Testing Timed Sequences

If one is testing out a sequence using a timed command it can be done quickly without using the clock. The following command can be entered from the System Monitor:

<JC mmmm ss>

where mmmm is the time in minutes since midnight. This is (hours * 60) + mins and is how the time is held within EX‑CommandStation. So for the time in the example above (6:15) the following:

<JC 375 4>

would execute the command immediately (4 being the perceived speed factor i.e. 1 minutes every 15 seconds). The EX‑CommandStation would respond with:

<jC 375>

And would then display any messages generated by the SEQUENCE 10.

The final command available is:

<JC>

which requests the latest time from EX‑CommandStation which responds with:

<jC 375>