[En-Nut-Discussion] The Watchdog timer
Sigurd Kleppan
021243 at student.hit.no
Tue Oct 5 14:00:27 CEST 2004
Hey!
I'm trying to program the watchdog timer in my application. I have red the datasheat for at Atmega128. When i delay the watchdogtimer I sample that it not runs more than 40 microsecond before reset. The datasheat say that is shoud run i at least 2 secons. I want my watchdog to run a couple of seconds, then get a refreshed.
If my program crash, the board will be reset.
Could someone give med a code hint. What is wrong?
//watchdog
for(;;){
sbi(WDTCR,3);//enable wathdog
sbi(WDTCR,0);//set the 2 seconds wait
sbi(WDTCR,1);
sbi(WDTCR,2);
NutSleep(100);//wait (time for other applications to run)
sbi(WDTCR,4);//enable for reset
cbi(WDTCR,3);//reset
}
More information about the En-Nut-Discussion
mailing list