We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello All! I want to reset 89v51RD2 in less than 1 ms after external Interrupt.
i wrote this code
void external(void) interrupt 0 // External INT0 ISR { EA = 0; // interrupt disable WDRE=1; SWDT=1; while(1); // wait till reset }
but it didn't worked. Please help
According to Datasheet:
To protect the system against software deadlock, the user software must refresh the WDT within a user-defined time period. If the software fails to do this periodical refresh, an internal hardware reset will be initiated if enabled (WDRE = 1). The software can be designed such that the WDT times out if the program does not work properly.
The WDT in the device uses the system clock (XTAL1) as its time base. So strictly speaking, it is a Watchdog counter rather than a Watchdog timer. The WDT register will increment every 344,064 crystal clocks. The upper 8-bits of the time base register (WDTD) are used as the reload register of the WDT. The WDTS flag bit is set by WDT overflow and is not changed by WDT reset. User software can clear WDTS by writing ‘1' to it.
Two SFRs (WDTC and WDTD)control Watchdog timer operation. During idle mode, WDT operation is temporarily suspended, and resumes upon an interrupt exit from idle. The time-out period of the WDT is calculated as follows:
Period = (255 - WDTD) 344064 1/fCLK (XTAL1)
where WDTD is the value loaded into the WDTD register and fosc is the oscillator frequency
WDTC - Watchdog control register (address COH) bit allocation Bit addressable; Reset value: 00H Table: Bit 7 6 5 4 3 2 1 0 Symbol - - - WDOUT WDRE WDTS WDT SWDT
Table: WDTC - Watchdog control register (address COH) bit description Symbol > Description
WDOUT > Watchdog output enable. When this bit and WDRE are both set, a Watchdog reset will drive the reset pin active for 32 clocks. WDRE > Watchdog timer reset enable. When set enables a Watchdog timerreset.
WDTS > Watchdog timer reset flag, when set indicates that a WDT reset occurred. Reset in software. WDT > Watchdog timer refresh. Set by software to force a WDT reset.
SWDT > Start Watchdog timer, when set starts the WDT. When cleared,stops the WDT
Advance Thanks!
I had a bit of time and, against every reason, took a glance at the datasheet.
"against every reason" because it is YOUR responsibility to read the datasheet.
However, the below seems to be your problem.
Reading the original post would probably be a good idea.