??? 07/21/04 16:17 Read: times |
#74612 - RE: WD in lengthy functions Responding to: ???'s previous message |
I have a baaad feeling about this.
I've been there - CLR EA ... SETB EA looks very easy. But what if during that time a falling edge on INT arrives, or some other interrupt event happens? Sometimes I just can't safely disable interrupts... Would someone please explain WHY should they be disabled (other than manufacturer's fancy)? BTW, I think resetting watchdog from timer interrupt could be a good idea to avoid starving the lower priority routines. Like, in my "encoder pulse counter", if the encoder was turning fast enough, the interrupts were missed because of not enough CPU time - and the main program was slowing down to a crawl. Just set the watchdog timer to a bit over twice the length of most time consumming high priority interrupt and put the reset on a lower priority interrupt, possibly twice as often or more. If the high priority interrupt happens 2 times in a row, okay, we accept that (there's the interrupt bit set we can wait) but if it happens 3 or so times in a row without letting anything of lower priority to work, it soon will starve itself too. Timer routine didn't get its share to reset the watchdog? Reset, alarm that the CPU doesn't have enough power to process so many events or our program needs a more optimal rewrite. |