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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/24/03 19:08
Read: times


 
#55398 - RE: A few techniques...Cygnals Method
Responding to: ???'s previous message
Here is text copied from a Cygnal data sheet that describes how their onboard watch dog works.

Watchdog Timer Reset

The MCU includes a programmable Watchdog Timer (WDT) running off the system clock. The WDT will force the
MCU into the reset state when the watchdog timer overflows. To prevent the reset, the WDT must be restarted by application software before the overflow occurs. If the system experiences a software/hardware malfunction preventing the software from restarting the WDT, the WDT will overflow and cause a reset. This should prevent the system from running out of control.

The WDT is automatically enabled and started with the default maximum time interval on exit from all resets. If desired, the WDT can be disabled by system software or locked on to prevent accidental disabling. Once locked, the WDT cannot be disabled until the next system reset. The state of the /RST pin is unaffected by this reset.

Watchdog Usage

The WDT consists of a 21-bit timer running from the programmed system clock. The timer measures the period
between specific writes to its control register. If this period exceeds the programmed limit, a WDT reset is generated. The WDT can be enabled and disabled as needed in software, or can be permanently enabled if desired.

Watchdog features are controlled via the Watchdog Timer Control Register (WDTCN).

Enable/Reset WDT

The watchdog timer is both enabled and reset by writing 0xA5 to the WDTCN register. The user's application software should include periodic writes of 0xA5 to WDTCN as needed to prevent a watchdog timer overflow. The WDT is enabled and reset as a result of any system reset.

Disable WDT

Writing 0xDE followed by 0xAD to the WDTCN register disables the WDT. The following code segment illustrates disabling the WDT.
   CLR   EA            ; disable all interrupts
   MOV   WDTCN,#0DEh   ; disable watchdog timer
   MOV   WDTCN,#0ADh   ;
   SETB  EA            ; re-enable interrupts

The writes of 0xDE and 0xAD must occur within 4 clock cycles of each other, or the disable operation is ignored. Interrupts should be disabled during this procedure to avoid delay between the two writes.

Disable WDT Lockout
Writing 0xFF to WDTCN locks out the disable feature. Once locked out, the disable operation is ignored until the next system reset. Writing 0xFF does not enable or reset the watchdog timer. Applications always intending to use the watchdog should write 0xFF to WDTCN in their initialization code.

Setting WDT Interval
WDTCN.[2:0] control the watchdog timeout interval. The interval is given by the following equation:
43+WDTCN[2:0] x TSYSCLK , 

(...where TSYSCLK is the system clock period). For a 2.0 MHz system clock, this provides an interval range of 32msec to 524msec. WDTCN.7 must be written as 0
when setting this interval. Reading WDTCN returns the programmed interval. WDTCN.[2:0] is 111b after a system
reset.

Michael Karas


List of 26 messages in thread
TopicAuthorDate
A few techniques...            01/01/70 00:00      
   RE: A few techniques...            01/01/70 00:00      
   RE: A few techniques...            01/01/70 00:00      
      RE: A few techniques...            01/01/70 00:00      
      RE: A few techniques...            01/01/70 00:00      
         RE: A few techniques...            01/01/70 00:00      
            RE: A few techniques...            01/01/70 00:00      
            RE: A few techniques...            01/01/70 00:00      
               RE: A few techniques...            01/01/70 00:00      
                  RE: A few techniques...            01/01/70 00:00      
                     RE: A few techniques...            01/01/70 00:00      
                        RE: A few techniques...            01/01/70 00:00      
                           RE: A few techniques...            01/01/70 00:00      
                           RE: A few techniques...            01/01/70 00:00      
                        RE: A few techniques...Cygnals Method            01/01/70 00:00      
                           RE: A few techniques...Donald            01/01/70 00:00      
                              RE: A few techniques...Donald            01/01/70 00:00      
                           RE: A few techniques...Cygnals Method            01/01/70 00:00      
                  more            01/01/70 00:00      
                     RE: more            01/01/70 00:00      
         RE: A few techniques...            01/01/70 00:00      
            RE: A few techniques...            01/01/70 00:00      
               RE: A few techniques...            01/01/70 00:00      
         RE: A few techniques...            01/01/70 00:00      
            RE: A few techniques...            01/01/70 00:00      
   do subscribe            01/01/70 00:00      

Back to Subject List