On Wed, 7 Jan 2004 17:58:24 -0000, Michael Rigby-Jones wrote on Re: [PIC:] Pic as an i2c slave: >Out of interest what is pathetic about the attempt to deliberately fire = a >watchdog timeout by using an infinite loop? Surely you agree that it is >good practice to trap invalid states such as this? Oh yes, that was mere irony on my part, targeted to noone in particular, or may be to the programmer that wrote this -supposedly erroneous- piece of code. However it may not be an efficient trap: I know it is sound practice to activate a watchdog that will reset your chip if your program loops forever or otherwise fails to execute properly, may be because the chip was hit by a cosmic ray etc.=20 This of course implies that your program's startup code can handle such reset conditions and restart (as opposed to start) gracefully from where it was at the time of the mishap. I our case, a watchdog reset is created on purpose because in our i2C logics we have reached a point that noone should ever reach. My idea is that proper recovery should be in order at that point, not just this reset kludge.=20 I may be wrong but I base this opinion the fact that unless the cause of the problem was purely random (like a cosmic ray hit), it is highly probable that the same causes will lead to the same result sooner or later, which itself will lead to resetting the part anew. Hence I would have preferred some garbage collecting routine to the effect of reinitialising the MSSP, as is described in one of the errata sheets for this very MSSP: if I remember well, the trick was to program the MSSP to SPI then to i2c again, that would fully reset the logics. I suppose that for the purpose of this application note, the people with microchip decided to oversimplify the routines for better pedagogy. However I still do not know what, according to past messages on this list, should be (or maybe has been) corrected in these routines. Amiti=E9s,=20 Robert * Xrobert.soubie@free.frX (veuillez supprimer les "X") * http://www.astrosurf.com/soubie * Au royaume des aveugles, les borgnes sont mal vus... - P.Dac -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads