electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Watchdog in AT89S8252 ?!?


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Watchdog in AT89S8252 ?!?
Author Message
mrcube_ns



Joined: 10 Apr 2002
Posts: 429
Helped: 11
Location: Dark side of the Moon


Post11 Dec 2003 15:18   

Watchdog in AT89S8252 ?!?


I need to use watchdog in AT89s8252 (I new in atmel programming).

How to do it?

Some code examples are welcome.

THANKS IN ADVANCE.

Mr.Cube
Back to top
Eskimo



Joined: 09 Apr 2002
Posts: 35


Post11 Dec 2003 16:38   

Re: Watchdog in AT89S8252 ?!?


Sample code

//Refresh macro
#define REFRESH_WATCHDOG() WMCON = WMCON | 0x02

void main()
{
// Init WatchDog
WMCON = WMCON | 0xE0; /* TimeOut Period = 2048ms */
WMCON = WMCON | 0x01; /* Enable WatchDog*/

while (1)
{
//Refreshing
REFRESH_WATCHDOG();
}
}
Back to top
C-Man



Joined: 19 Jul 2001
Posts: 1235
Helped: 73


Post11 Dec 2003 16:58   

Re: Watchdog in AT89S8252 ?!?


A little tip: do not refresh your watchdog inside an interrupt routine because most of the time interrupts are still running while your main routine has crashed for some obscure reason Smile

Better refresh your watchdog inside a routine which is not called too often or set some flags inside a few routines and only refresh your watchdog (and reset the flags) when all flags are set (this can be done inside your interrupt routine), works much better for me ...

best regards
Back to top
mrcube_ns



Joined: 10 Apr 2002
Posts: 429
Helped: 11
Location: Dark side of the Moon


Post12 Dec 2003 23:48   

Re: Watchdog in AT89S8252 ?!?


If I understand well you must refresh wd every 2 sec (max), on which xtal?

Mr.Cube

PS. C-man don't you afraid that your uC will restart if some of those flags aren't set ('couse of some conditions or input states)?
Back to top
Google
AdSense
Google Adsense




Post12 Dec 2003 23:48   

Ads




Back to top
Eskimo



Joined: 09 Apr 2002
Posts: 35


Post13 Dec 2003 1:00   


WD operates from an independent oscillator.
Look at datasheet page 9.
http://www.atmel.com/dyn/resources/prod_documents/doc0401.pdf.
Refresh must be faster then slected period.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Watchdog in AT89S8252 ?!?
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
AT89S8252 Watchdog (1)
AT89S8252 Ext Watchdog (6)
Programming AT89s8252 (5)
Atmel AT89S8252 EEprom (1)
at89s8252 and keil ?? (8)
Atmel AT89S8252 replacement (5)
Programmer for AT89S8252 (7)
µcontroller AT89S8252 schematic (2)
AT89S8252 Reset issues (2)
MMC with AT89s8252 (2)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS