Microchip® Advanced Software Framework

Reset WDT in interrupt mode

In this use case, the WDT is configured for:

  • interrupt mode
  • Timeout period of 32 ms

The use case enables the WDT in interrupt mode, and resets it after 25 ms to prevent wdt interrupt to get triggered after period of 32 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 4K cycles or 32 ms:
  2. Set callback funtion:
  3. Enable WDT in interrupt mode:

Usage steps

Example code

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

Workflow

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