Go to Triangle Digital Support Home Page TDS9092 TECHNICAL MANUAL
Hardware support
Live website search
Enter key words




( n1 - a n2 )

Day number to printable date string, format 25.12.95


( d - a n )

Ticks to printable time string. Each tick 53.333ms


(  -  )

Enable timer 1 overflow interrupt


(  -  )

Disable timer 1 overflow interrupt


(  -  )

Print current date in format 25.12.95


(  -  )

Print current time in format 17.09.55


( n - day,mth,yr)

Day number to date


( d - secs,mins,hrs)

Ticks into normal units


( - n )

Date in days since 1.01.84


( - d )

Ticks into the day; double word


( - a )

Variable containing day number since 1.01.84


( d - n )

Date as 25.12.95 to day number


( day,mth,yr - n)

Normal units to day number


( d - )

Set time from double no, format 17.09.00


( - a )

Variable containing minutes into the day


( n - )

Delay by 1 to 32767 ms (software loop)


( d - )

Set date from double no, format 25.12.95


( n - )

Delay by 1 to 32767 units. One unit approx 3.3s


( secs,mins,hrs - d

Converts normal units to ticks


( - a )

Variable containing parts of a minute (1125 ticks per minute)


( n - )

Delay by 1 to 32767 units. One unit approx 64s


The TDS9092 maintains time and date through the above Forth words. Power must be applied to the board or the time and date will be lost, but a built-in mechanism described below allows you to use the low power 2 to 3mA mode and still maintain this function. For a completely non-volatile clock see the section NON-VOLATILE CLOCKS.

When power is first applied, the time is set to 00.00.00 and the date to 1.01.84. An interrupt is already set up which causes this time and date to increment. The correct time and date can now be set with NOW and HRS . For example, at 9pm on Christmas evening:


25.12.95 NOW 21.00.00 HRS


The date and time can be sent to the serial link with .DATE and .TIME and by re-vectoring EMIT they can be written to an LCD, sent to the serial port, or output in any other way.

Other words provided allow other formats for date and time which are used in USA and other countries. For example:



2 U.R "/ EMIT R> 2 U.R ;


This outputs the above date as 12/25/95 instead of 25.12.95. The dates computed adjust automatically for leap years.

The raw data which the Forth words use are in the 3 variables TICKS MINS DAYS . These can be accessed directly to give special functions.

The clock works using the Timer 1 Overflow Interrupt. Every 53.333ms this interrupt increment the ticks register, and each minute resets it and increments the minutes register. Once per day the minutes register is reset and the day register is incremented. The words shown above work with these three variables. The interrupt is written in machine code and only takes 40s every 53ms. This represents less than an 0.08% overhead but it can be eliminated with -TIMER .

When the low power operational mode is used, the microprocessor is in standby most of the time and the interrupt does not work; only a reset will take the microprocessor out of standby. However, when the watchdog timer restarts the microprocessor, it gives two increments to the ticks register. The watchdog time period is exactly twice the usual interrupt repetition rate so the correct time is maintained. See the section LOW POWER OPERATION for more details of this mode.

Some care is necessary when using the low power mode:


q       No word which resets the watchdog timer should be used in the sequence the machine will usually take from watchdog reset to standby. For this reason the word IF does not service the watchdog. Remember that looping words such as BEGIN DO +LOOP etc. all reset the watchdog.

q       If the machine is allowed to power up, through pressing a matrix key, for example (to take the case shown in the LOW POWER OPERATION section), then keep it up for a significant time, say 10 seconds at least. This will minimise the effect of the possible loss of a few microcycles at the transition between the interrupt and watchdog timekeeping mechanisms. Keep the transitions as low as feasible. Each gives accurate timekeeping but transitions may slow the clock a fraction.

Go to Triangle Digital Support Home Page Go to top   Next page