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




( - )

Services the watchdog timer


The watchdog acts as a check on the microprocessor. If it crashes through power spike or otherwise the watchdog timer will reset the system and the application software will be re-entered. It is a counter external to the microprocessor in the TDS9 gate array (106ms). It is reset by many Forth words and normally you will not notice its action, but will time-out and re-start the system if something goes wrong.

The watchdog is reset by many Forth words - all looping words like BEGIN UNTIL REPEAT DO LOOP etc. service the timer. In addition some words written in machine code which can take a long time to execute also do it. Among these are -FIND FILL CMOVE MS WAIT . Of the three delay words REST WAIT MS only the first does not reset the watchdog. Correct operation can be checked by feeding a large number to REST . The first of these commands will work, but the second will cause the internal watchdog to reset the board, it takes just a bit too long. Try it:


32000 REST     33000 REST


In application programs written in Forth the presence of the watchdogs can normally be completely forgotten. A single loop of 107ms or more would need a watchdog service; in this case include the word WDT in the loop.

The blue reset button, external resets and errors like watchdog timeouts normally give warm re-starts into your application program.

See the flow diagram in the section STAND-ALONE SYSTEMS to understand the default actions of watchdog and other restarts.

The watchdog timer is independent of the microprocessor. It is a multistage binary divider in the gate array and is fed directly from the oscillator. After the divider is reset by a watchdog service a time of 106ms passes and then the open drain output (similar to open collector) is pulled low. This resets the board exactly as pulling down the external reset on pin c23 would do, giving your program a warm re-start.


When writing assembler programs it is essential to remember the watchdog. It is serviced by either a read or write into the memory address area hex 0160 to 016F. Include


$0160 A STA,


wherever the program may stay in a loop for more than 106ms. For example, the following routine collects a text string from the serial input. It has to wait for each character and since the time between each will depend on the sending computer, the watchdog must be reset within the loop which awaits the data ready flag:


$0160 CONSTANT WDTADDR  ( address to service

                        ( watchdog

$11   CONSTANT TRCSR1   ( serial port 1 control

                        ( register address

$C0   CONSTANT RDRF     ( data ready flag OR

                        ( overflow flag

$12   CONSTANT RDR      ( serial port data register

CODE COLLECT ( a -   collect string ending in LF

                        ( from the serial input to

                        ( memory at address a



             EQ NOT, UNTIL,

          RDR B LDA,  0 ,X B STA,   ( to buffer

          INX,  $0A ## B CMP,       ( line feed?


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