Microchip® Advanced Software Framework

Quick start guide for WDT driver

This is the quick start guide for the Watchdog Timer (WDT), with step-by-step instructions on how to configure and use the driver in a selection of use cases.

The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g., the main application function.

Basic use case - Reset WDT in standard mode

WDT use cases

Basic use case - Reset WDT in standard mode

In this use case, the WDT is configured for:

  • Standard mode
  • Timeout period of 8 ms

The use case enables the WDT, and resets it after 5 ms to prevent system reset after time out period of 8 ms.

Setup steps

Prerequisites

For the setup code of this use case to work, the following must be added to the project:

  1. Busy-Wait Delay Routines

Example code

Add to application initialization:

Workflow

  1. Set timeout period to 8 cycles or 8 ms:
  2. Enable WDT:

Usage steps

Example code

Add to, e.g., main loop in application C-file:

Workflow

  1. Wait for 5 ms:
  2. Reset the WDT before the timeout period is over to prevent system reset: