??? 07/21/04 12:37 Read: times |
#74570 - RE: WD in lengthy functions Responding to: ???'s previous message |
To reset watchdog counter I need do some steps: disable all interrupts, write 0x1E then 0xE1 into watchdog SFR then re-enable interrupts.
These specific steps makes it virtually impossible that runaway code can pet the puppy. ; somewhere inside ISR of PCA (counter overflow condition): INT_PCA_OVER: ; check if watchdog counter reset is required somewhere JNB FLG_WATCHDOG,INT_PCA_WATCHDOG_END CLR EA MOV WDTRST,#0x1E ; reset watchdog counter MOV WDTRST,#0xE1 CLR FLG_WATCHDOG ; clear request flag SETB EA INT_PCA_WATCHDOG_END: ; ...Now you have a situation where all runaway code has to do is set a bit. That is much more likely to happen than the steps required to pet the puppy. You still need to do some action (in your case set a flag as opposed to invoking a macro) in a timely manner, in that respect there is no difference. Please explain, where is the gain using setb FLG_WATCHDOG over PET_THE_PUPPY ; a macro Erik |