Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/23/03 14:28
Read: times


 
#61266 - RE: Watch Dog Timer (WDT)?
Responding to: ???'s previous message
Dear Arif,

For WDT,Suppose you have written a program that is continuously running on a PIC. Now, you want to make sure that this program is always running, and that no matter what happens it will never stop. The first thing you would have, of course, is a loop back at the end of the program that brings us back to the start of the program. But consider this case. Let us say that the PIC is monitoring an input. When this input goes high, it jumps to another part of the program and waits for another pin to go high. If the second pin doesn’t go high, the PIC will just sit there and wait. It will only exit if the second pin goes high. Let us consider another example. Suppose you have written a program. You have compiled it successfully, and you have even simulated it over and over again using a simulator such as MPLAB. Everything seems to work fine. You program the PIC and place it into a circuit. However after a long period of time, the program gets stuck somewhere and the PIC gets caught in a loop. What’s needed in both cases is some kind of reset if the program gets stuck. This is the purpose of a watchdog circuit.

A watchdog circuit is nothing new. Many microprocessors and microcontrollers have them. But how does it work? Well, inside the PIC there is a resistor/capacitor network. This provides a unique clock, which is independent of any external clock that you provide in your circuit. Now, when the Watchdog Timer (abbreviated to WDT) is enabled, a counter starts at 00 and increments by 1 until it reaches FF. When it goes from FF to 00 (which is FF + 1) then the PIC will be reset, irrespective of what it is doing. The only way we can stop the WDT from resetting the PIC is to periodically reset the WDT back to 00 throughout our program. Now you can see that if our program does get stuck for some reason, then the WDT will not be set. The WDT will then reset the PIC, causing our program to restart from the beginning.

In order to use the WDT, we need to know three things. First, how long have we got before we need to reset the WDT, secondly how do we clear it. Finally, we have to tell the PIC programming software to enable the WDT inside the PIC. Let’s look at these separately.

I hope this will be helpfull.

Regards
Hatem Zakaria


List of 18 messages in thread
TopicAuthorDate
Watch Dog Timer (WDT)?            01/01/70 00:00      
   RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
      Yer tiz            01/01/70 00:00      
         RE: Yer tiz            01/01/70 00:00      
   RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
   RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
      RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
   RE: Watch Dog Timer (WDT)? Jack            01/01/70 00:00      
   Which way?            01/01/70 00:00      
      RE: Which way?            01/01/70 00:00      
         RE: Which way?            01/01/70 00:00      
            RE: Which way?            01/01/70 00:00      
      Internal watchdogs            01/01/70 00:00      
   RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
      RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
         RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
            RE: Watch Dog Timer (WDT)?            01/01/70 00:00      
            RE: Watch Dog Timer (WDT)?            01/01/70 00:00      

Back to Subject List