JMRI® connects to...
Controller Area Networks (CAN)
Supported Hardware
Devices, command stations, networks, and protocols:
By the community of
JMRI tools for working with your layout:
Layout Automation
Use JMRI to automate parts of your layout and operations:

JMRI Help:

Contents Index
Glossary FAQ

Donate to JMRI Donate to

Hardware Support: CBUS - Fast Clock

Since 4.19.6

JMRI maintains an Internal Fast Clock which is used in various places including RfID Tag Timestamping, and layout automation tools.

The CBUS Fast Clock can be used to send this internal clock data to a CBUS Network, enabling other network devices to use the same time and date.

JMRI can also listen to the CBUS Network for incoming Fast Clock data which is used to update the internal clock.

If you aren't sharing time data across the network, the internal Fast Clock will provide all of the functionality you need, without having to send or receive it via CBUS.

Internal Fast Clock, and extra CBUS functionality are configured in the main Fast Clock Setup Window,
PanelPro > Tools > Clocks > Set Up Fast Clock ...

Sending Fast Clock data to Network

CBUS Fast Clock Incoming

Open up the Fast Clock Setup Window.

Ensure that Internal Computer Clock is selected as the time source.

Check the Synchronise CBUS Fast Clock checkbox.

The Fast Clock Configuration is stored in xml, remember to store your setup!

When the clock is paused / resumed, the appropriate CBUS FCLK message is sent.

Each time the Internal Fast Clock rolls over a minute, a CBUS FCLK message will be sent.

Data includes clock speed rate, minute, hour, day of month, day of week, month, and a temperature field ( which defaults to 0 ).

If the Internal Fast Clock Speed Rate is not a whole number, the Fast Clock Rate ( DIV value ) will be sent excluding the decimal ( ie no rounding up ). For a receiving Fast Clock to accurately calculate second changes this should be set to a whole number, however for many applications this is not a requirement.

Receiving Fast Clock data from Network

Open up the Fast Clock Setup Window.

Ensure that CBUS Fast Clock is selected as the time source.

Check the Synchronise CBUS Fast Clock checkbox.

The master JMRI date and time will now be set whenever CBUS FCLK OPCs are heard on the network.

The master JMRI clock will be paused and resumed according to the incoming CBUS FLCK OPCs.

The Clock speed rate and CBUS Fast Clock temperature fields are also updated.

If an external Fast Clock is not sending updates ( and the clock is not paused ), the Internal Clock will continue updating the master JMRI time.

This behaviour is likely undesirable on startup, so you may to have the master clock paused on startup.
Start Up Options > Start with Fast Clock > Stopped

The Fast Clock Configuration is stored in xml, remember to store your setup!

Initially, JMRI attempts to update the whole date, using the minute, hour, day of month, and month fields.
If this is impossible ( eg. 29th feb in non-leap year / month 17 ), a second attempt is made to set the Internal clock using just the hour / minute fields, and the current clock date.

Pausing and Resuming Internal Clock via CBUS Event

The JMRI master clock can be paused / resumed by CBUS event.

After you've set the clock running for the first time, there will be a new Internal Sensor called "ISCLOCKRUNNING".

Use Logix ( or Light Control ) to set a CBUS Sensor ( operated via CBUS event ) to command this Internal Sensor to On and Off for a remote pause / resume by CBUS event.

For multiple operators, the pause buttons could send an OFF, with a master resume button sending the ON.

Triggering CBUS Events by Fast Clock

To send on / off CBUS events at certain fast times, use Light Controls or Logix.

CBUS Lights are a good choice for beginners, sending ON / OFF events whenever they are switched on / off.

You can add lots of simple automation tasks with these by using Fast Clock Light Controllers.

This enables scheduled tasks, eg Streetlights, house lights, sunset / sunrise etc.

Accessing the Date / Temperature Fields

The fast clock time will be updated in a JMRI memory variable.
This format can be changed to include day, month and year, see main JMRI Fast Clock support.

Jython scripting can set the date, along with getting and setting the temperature field.

eg. A script could listen for a particular event which could carry a temperature value in its added data.


JMRI Fast Clock Setup

JMRI Fast Clock Overview

JMRI Light Controllers - Fast Clock Controlled.

CBUS® is a registered trade mark of Dr Michael Bolton