Keil Logo

C16x/ST10 Watchdog Timer Example Program

This example program shows you how to use the watchdog timer on the C16x family.

To enable the watchdog timer, the startup code must be modified. By default, the startup code disables the watchdog timer so that users new to the C16x aren't required to handle watchdog resets. To enable the watchdog, look for the following section in the startup code (START167.A66) and set WATCHDOG to 1.

//WATCHDOG: Disable Hardware Watchdog
//--- Set WATCHDOG = 1 to enable the Hardware watchdog
$SET (WATCHDOG = 1);

The C program configures the watchdog timer in divide by 2 mode and sets the reload value to 128 (0x80). The _srvwdt_ function executes the srvwdt instruction which services the watchdog.

The C program (after a while) stops servicing the watchdog timer and the program resets. A breakpoint is set on the reset vector to output Watchdog Reset and halt execution in the event of a watchdog timer reset. Refer to DEBUG.INI for the breakpoint and function that check the watchdog status.

You may open the watchdog timer dialog from the peripherals menu to view the status of the watchdog.

To run this example program:

  1. Start the debugger.
  2. Run the program.
  3. Watch the Command Window for the Watchdog Reset message.
C16X_WDOG.ZIP (41K)
Wednesday, July 3, 2002
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.