This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Watchdog reset Philips 89v51RD2

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 want to reset 89v51RD2 in less than 1 ms after external Interrupt.

    So why don't you just connect that external line to the RESET input (with some glue logic as needed)?

    but it didn't worked.

    You need to be more specific. What actually happened? And why didn't that qualify as "it worked"?

    Oh, and what did you get from inserting your values into the formula from the data sheet:

    The time-out period of the WDT is calculated as follows:

    Period = (255 - WDTD) 344064 1/fCLK (XTAL1)

    Does the result match your requirements?

  • Please don't be so rude!

    I Can not use Reset Pin
    Because some Logic high Problem related with a motor

    Please Help me i have to reset in that external ISR
    as i mentioned code above,

    Actually Watchdog reset doesn't cause problems with motor.

    i used earlier in AT89S52.

    Please help please

  • "Because some Logic high Problem related with a motor"

    Isn't that covered by:

    "(with some glue logic as needed)?"

    If not, what is "some Logic high Problem", and why can't it be solved with "some glue logic"?

    If you want good-quality answers, you have to provide good-quality information to go on...

  • I Can not use Reset Pin

    Then maybe you ought to find someone who can.

    Actually Watchdog reset doesn't cause problems with motor.

    How do you know that, given that, by your own words, your watchdog reset "doesn't work" (whatever that means)? And what "problems with motor" are you talking about, anyway?

    Please help please

    How? You're making it completely impossible to help you. You didn't even try to answer of the question I asked you. None of the things you've said so made sense, ripped out of whatever they context they might have been in.

  • If the processor is generating the timing for a stepper motor, then a watchdog reset will - just as other reset sources - affect the driving.

    A watchdog may be used to generate an interrupt or to reset the processor. If you have a hw lockup somewhere, then the use of the watchdog as an interrupt will most probably not sovle your problem. If you use the watchdog to reset the processor, then the main difference from using the reset pin is that most processors has a status register to inform about which reset reason there where (power-on, brown-out, reset line, watchdog reset, ...). But a processor reset from any source will normally affect all peripherials, such as the sequencer output of the motor drive signals.

    Some processors allows the watchdog to first generate an interrupt, and then after yet more time perform a full reset. Then the interrupt handler may possibly perform some "clean-up" actions before the full reset happens.

  • I Can not use Reset Pin
    Because some Logic high Problem related with a motor

    Is this "you must start the processor before the motor because the high om px.y creates havoc"?

    If so, you can not use ANY form of reset till you insert an invrter between the port pin and the motor control.

    Erik

  • Actually if someone push Reset button for long time causes motors continuous run.
    and also problem related to devic that is programmed for logic high.
    I use logic 1 to start the motor bcoz predesigned driver(Circuit with relay) for AC Motor.

    when i used in AT89S52 with Watchdog reset, it didn't start the motor after reset.

    At that time DAN HENRY helped me.
    Where are u DAN?

    I only want to use Watchdog by Interrupt as general Reset nothing else.

    
    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
    
    

  • I use logic 1 to start the motor bcoz predesigned driver(Circuit with relay) for AC Motor.

    A driver circuit that turns on a peripheral during processor reset is wrong. It's a simple as that.

    Port pins have documented states at reset for a reason --- it's so you can design the surrounding circuits so they do the right thing during reset.

    I only want to use Watchdog by Interrupt as general Reset nothing else.

    So you've said several times now. You also claimed it "didn't work" --- which doesn't tell anybody anything. What you still have not said, in all these days, is what your actual problem is.

  • I used
    SWDT which Starts Watchdog timer, when set starts the WDT

    which causes reset

    I have written same on the TOP of thread!

    But what is wrong? it doesn't reset uC.

  • SWDT which Starts Watchdog timer, when set starts the WDT
    which causes reset

    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.

    "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 code in the first post contains:

    WDRE=1;
    SWDT=1;
    

  • SWDT which Starts Watchdog timer, when set starts the WDT

    You've already demonstrated you can copy-paste from data sheets. But do you understand them.

    I have written same on the TOP of thread!

    Indeed you did. But nobody asked you questions about what you did. We asked questions about why you did it, and how exactly it failed to work.

    But what is wrong?

    Guess what, I've asked you that same question 4 days ago. You chose to consider that "rude".

    it doesn't reset uC.

    So we finally get an answer: you think there's no reset being done at all. How do you know that? A reset internal to the uC can be quite hard to detect from the outside.

    Did you check that the interrupt handler is called in the first place?

  • ok!
    It takes aprrox 9 to 10 sec to Reset for 12Mhz clock

  • Thanks for helping
    Thank you so much

    its:

    WDTD=254;
    

    .

  • 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.