Simon Bryden wrote: > > I just had a weird case of EEPROM corruption on a 16F84. The first 14 words > were overwritten to the value 0xAE during a thunderstorm which tripped the > power. > > The thunderstorm is probably a red herring, and the power loss may be more > likely to be a contender, > Does anyone have any thoughts on what could have caused this? BTW code memory > was untouched, and once I had written sensible values back to the EEPROM, all > was ok. Yes. :o) When the micro gets a BAD spike, ie current through the die in either direction, it can corrupt all registers including stack and program counter. The little flip flops in the registers get flipped and flopped, often towards the direction of the spike, (which can be used to "force" ram in some cases) If registers and PC etc could maybe contain trash or even just a few trash bits, it could have jumped to or otherwise entered your eeprom write routine. When it go there with unknown crud in all the registers it performed as well as it could and wrote *stuff* to *somewhere* in eeprom. Some of the micros can have bits set to 1's by hitting them with a voltage spike. When we were teenagers I saw a piezo spark igniter (reliably) clock up games on a Galaga arcade machine, by zapping the main coin entry plate it spiked the micro and instantly jumped the "coins" variable from 0 to 99. I assume the spike set the variable to all 1's (0xFF) and safety code trimmed it to 99 for the 2 digit display. Sometimes the video ram to the Z80 micro got hit and most of the screen would go white. I was employed part time fixing these machines and saw the results of deliberate spike attacks regularly. :o) -Roman -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics