# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# PIC24FJ32MC10X -- Watchdog Timer

- 1
- 2
…
- 6
- 7
- 8
- 9
- 10
- 11
- 12

PIC24F Family Reference Manual
DS39697B-page 9-8 © 2010 Microchip Technology Inc.
9.4 DESIGN TIPS
Question 1: Why does the device reset, even though I have inserted a CLRWDT
instruction in my main software loop?
Answer: Make sure that the software loop that contains the instruction meets the minimum
specification of the WDT (not the typical value). Also, make sure that interrupt
processing time has been accounted for.
Question 2: What are good techniques for using the WDT in my application?
Answer: There are many techniques for using the WDT to prevent applications from
locking up or running away. When they are carefully analyzed, most of them
depend on three basic principles:
1. Use one, and only one, CLRWDT instruction in your application. Placing
multiple occurrences throughout the application makes it more difficult to
troubleshoot time-out issues.
2. Place the CLRWDT instruction inside the main body of the application and
not inside a subroutine or an Interrupt Service Routine (ISR). If the instruc-
tion is located inside a frequently called routine, there is a good chance
that the WDT will constantly be reset and never time-out.
3. Once the application is compiled and sized, place unconditional branch
instructions (such as, “GOTO .”) throughout the unused area of program
memory. If something should happen that makes the code “run away” by
branching into unused code space, the GOTO instructions can bring the
microcontroller back to your code, where the WDT can help bring the
application back under control.

- 1
- 2
…
- 6
- 7
- 8
- 9
- 10
- 11
- 12