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.

How to use watchdog in my C programs?

Status
Not open for further replies.

engraxate

Member level 3
Joined
Sep 2, 2001
Messages
63
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
377
watchdog ow to use it ?

Hi
I need some help how to use watch dog in my programs . I am usiing c compiler.for AVr
thanks
 

Re: watchdog ow to use it ?

Which CPU are you using?
Do you want to use an external watchdog or is it an integrated part of you CPU?
 

Re: watchdog ow to use it ?

While we are on this topic,my question is :
Why does one need a watchdog?
 

Hi raticus,

Simple answer
We need the Watchdog timer because it can reset the MCU if it hangs.

Bye
 

Re: watchdog ow to use it ?

But surely if your mcu hangs,you should be using a different mcu that does not hang.
I have been using pics for long now,and they never hang.
 

Re: watchdog ow to use it ?

I am using avr at90s8515and z8 encore.
I know what is watch dog, but I don´t know how to use it in my programs. I would like to see some examples.
thanks
 

Re: watchdog ow to use it ?

For at90s8515 in IAR C use :

//Start WDT:
WDTCR=0x0d; //WDT=500 mS in 5V VCC

//Reset WDT:
__watchdog_reset(); //Put it in long loops...

You can also use assembler WDR instruction in any compiler to reset WDT.
 

Dear engraxate,

Plz be carefull with watchdogs!!
If you fail to "feed" the WD at regular times (for example due to a a function wich takes longer to execute than the WD refresh rate), your device will reset without warnning even the processor is not "frozen"
Indded, for example if you are using floating point routines from a C compiler, it's verry hard to simulate the amount of time taken by the routine for all cases.
The result will be a unexpected reset of your project in the midle of some important calculation!!!
This will give an verry bad impresion to the end user!!
 

Re: watchdog ow to use it ?

It is exactly for that reason that I recommend never ever use watchdog timers.
If the processor hangs,it is a piece of c*ap.
Chuck it and use a processor that does not hang.
Imagine your pc processor hangs every now and again?
While you are in the middle of some work,suddenly it starts to reboot?
You cannot make products based on processors that hang sometimes.
 

Re: watchdog ow to use it ?

If correctly implemented a hardware watchdog is a valuable asset to a microcontroller based design.
Companies such as Bosch, Motorola and Ford will request the use of a watchdog within their deisgns, especially in the automotive sector.
Bad implementation is the usual cause of watchdog problems.

Regards
NTFreak
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top