Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Cleanong watchdog in interrupt service routine of a timer

Status
Not open for further replies.

matusel

Member level 1
Joined
Nov 13, 2009
Messages
40
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Activity points
1,540
Cleaning watchdog in interrupt service routine of a timer - WDT and timer ISR

Hi, could someone tell me which drawbacks could have the cleaning the watchdog in a iterrupt service routine of a timer?

---------- Post added at 14:43 ---------- Previous post was at 14:35 ----------

I guess the answer could be... because if you get stuck in an infinite loop the watchdog won't work but, in which cases could I get stuck in such a loop?
 
Last edited:

The way I see it the watchdog reset should be used in the main code because if for any reason the code enters a situation with an endless loop (bu some code mistake or some unknown factor) the watchdog will not be cleared and the mcu will reset.

On the other hand since the code in the main stops in order for the interrupt to be executed and then resumes again this would mean that if you clear the watchdog inside the interrupt then the mcu will never get out of this situation , the interrupt will execute and will return to the stuck loop again.
 
The way I see it the watchdog reset should be used in the main code because if for any reason the code enters a situation with an endless loop (bu some code mistake or some unknown factor) the watchdog will not be cleared and the mcu will reset.

On the other hand since the code in the main stops in order for the interrupt to be executed and then resumes again this would mean that if you clear the watchdog inside the interrupt then the mcu will never get out of this situation , the interrupt will execute and will return to the stuck loop again.

So if i have some functions like delay or a sort of "while(a=b);" where a depends on a external parameter (user input) i have to "kick the dog" inside these functions is it correct?
 

Yes you have to reset the watchdog before it resets the mcu or you can disable it if this is what you want and enable it after the user input.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top