What is watchdog timer | Applications of watchdog timer
This page describes watchdog timer in microcontroller. It mentions applications of watchdog timer.
This is a mechanism which helps microcontroller reboots (or restarts) when software hangs due to any external or internal faults or issues. It is basically hardware timer which should be serviced periodically by the software program else it will generate the system reset.
As shown in the figure-1, Microcontroller (ATmega328) is transmitting to the device using UART port. Here microcontroller transmits character and waits for character to be received by the device. If the character gets lost then the code hangs.
The watchdog timer helps to overcome this situation. Here programmer will place "clrwdt" instruction at regular intervals in the source code. This is machine language instruction found in instruction set of PIC microcontroller.
Due to some reasons if this instruction does not get executed in some particular time period (known as time out period), the microcontroller gets reset. There are different registers and instructions used for various microcontrollers in order to enable watchdog timer. The time out period for watchdog timer should be specified in the program which is called initialization of watchdog timer.
When the watchDog timer times out, it will cause "RESET". After this microcontroller executes instruction from location 0x0000.
The figure-2 depicts the operation of the watchdog timer. The timer requires clock for its hardware operation. This clock is internal or external to the timer. The watchdog timer send reset signal to the processor/microcontroller when timeout is reached. Based on clock frequency, time out interval wll vary. For 16 MHz clock, timeout interval is 92 ms.
Applications of watchdog timer
Following are the applications of watchdog timer:
• An application in mobile phone is that display is off in case no GUI interaction takes place within a watched time interval. This will save good amout of battery power.
• An application in temperature controller is that if controller takes no action to switch off the current within preset watched time interval, the current is switched off and warning signal is raised as indication of controller failure. Failure to switch off current may burst a boiler in which water is heated.
• If Software hangs due to some bug/issue, it helps to reset the system automatically without any human interactions.
Microcontroller Related Links
Refer our Page on microcontroller versus microprocessor which explains similarities and differences between both.
Refer our Page on microcontroller programming using C language including example.
Refer our Page on microcontroller development kit manufacturers.
RS232 interface RS485 interface RS422 interface CAN interface SPI interface interface types and converters DigRF interface