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 system

WDT use cases

Basic use case - Reset WDT in system

reset mode In this use case, the WDT is configured for:

  • System rest mode
  • Timeout period of 16 ms

The use case enables the WDT, and resets it after 10 ms to prevent system reset after time out period of 16 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 2K cycles or 16 ms:
  2. Enable WDT:

Usage steps

Example code

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

Workflow

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