Olin Lathrop wrote: > Brent Brown wrote: > > Consider the method... > > > > Initialise once only in mainline code: > > watchcat = 0xAA > > > > During ISR: > > if watchcat = 0xAA > > watchcat = !watchcat (invert the value) > > > > At end of mainline code: > > if watchcat = 0x55 > > watchcat = !watchcat > > reset watchdog > > This is rather a convoluted way of saying the interrupt routine sets a flag > and the foreground code kicks the dog based on the flag. Yes, that is a good concise description, thanks. Don't miss the other point though - a boolean flag (single bit, 0/1) could be used but if the flag itself was randomly corrupted (software bug, ESD, EMI, whatever) there would only be a 50/50 chance of detection. Instead here an 8 bit token is used. It is initialised only once, thereafter modified by each section of code in a prescribed fashion. Somewhat analogous to a game of Chinese whispers. Corruption of the token itself now has a 255/256 chance of detection. -- Brent Brown, Electronic Design Solutions 16 English Street, St Andrews, Hamilton 3200, New Zealand Ph: +64 7 849 0069 Fax: +64 7 849 0071 Cell: +64 27 433 4069 eMail: brent.brown@clear.net.nz -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist