RNDr. VojtRNDr. Vojtěěchch KrmKrmííččekek vojtec@vojtec@icsics..munimuni..czcz Ing.Ing. ZbynZbyněěk Burek Burešš, Ph.D., Ph.D. zbynekzbynek..buresbures@@unobunob..czcz PIC12F629 / 675 Using Watchdog PIC12FPIC12F629 / 675629 / 675 UsingUsing WatchdogWatchdog WatchdogWatchdog TimerTimer provides recovery from a system problem e.g. a program that goes into an endless loop, or a hardware problem that prevents the program from operating correctly if the program doesn't reset the watchdog at some predetermined interval, a hardware reset will be initiated useful for unattended systems running both in normal and sleep mode normal mode ­ on overflow it initiates RESET sleep mode ­ on overflow it initiates wake-up CLRWDT instruction resets the watchdog timer Watchdog periodWatchdog periodWatchdog period a nominal time-out period of 18 ms (with no prescaler) a division ratio of up to 1:128 can be assigned to the WDT under software control by writing to the OPTION register -> max. period 2,3s CLRWDT and SLEEP instructions clear the timer AND prescaler Watchdog Timer in CWatchdog Timer in CWatchdog Timer in C in the header we have to enable or disablein the header we have to enable or disable watchdog by WDTEN or WDTDISwatchdog by WDTEN or WDTDIS configuration bits:configuration bits: __CONFIG(MCLRDIS & WDTEN & INTIO);__CONFIG(MCLRDIS & WDTEN & INTIO); CLRWDT() macro in C resets watchdog Watchdog Block DiagramWatchdog Block DiagramWatchdog Block Diagram WatchdogWatchdog RegistersRegisters Watchdog registersWatchdog registersWatchdog registers