PIC16F877A Code Memory Erase

Discussion in 'Embedded Systems and Microcontrollers' started by ActivePower, Jul 11, 2012.

  1. ActivePower

    Thread Starter Member

    Mar 15, 2012
    155
    23
    This might be a very amateur question to ask but what can cause a PIC's code memory to be erased? Specifically, PIC16F877A.

    I had my PIC attached to a protoboard and was blinking some LEDs using interrupt routines when I accidentally shorted the positive supply rail directly with the LED while removing the battery from the board (the circuit was still connected).
    There was a momentary spark but the LED did not blow out. Although it did stop blinking after that. (The same spark thing occurred with a decoupling capacitor although I don't understand why).

    I suspected that the PIC would have been damaged so I checked it by plugging it into my programmer which read it correctly.

    However, the programmer software (WinPicProg) did not show any code data in the PIC. Although, when I did a blank check it explicitly said that the device is NOT blank (I think this may be due the non-erasability of the config word).

    After I reprogrammed the PIC using the same hex file again, it worked.

    Could the data have been erased due to the sudden current or was this some protective measure or is my PIC faulty?

    Thanks!
     
  2. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,131
    267
    Sounds like your PIC is TOAST.
     
  3. ActivePower

    Thread Starter Member

    Mar 15, 2012
    155
    23
    Then why would it work after I re-programmed it?
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    While there are no "protective measure(s)" to prevent random voltage spikes from frying a chip I doubt the ROM could be erased by any external event other then a programming erase sequence.

    The problem with things like this is the uncontrolled unrepeatable nature of the event: you may not know what you really did to disturb the PIC and perhaps the memory was really fine.

    If you rebuilt the code or had the memory protection on it would fail a readback but still be quite fine.

    As long as it seems to be working now keep using it. I've had PICs where I shorted and killed a single pin but everything else worked. Just never seen a memory loss and would need "extraordinary proof of an extraordinary occurrence."
     
  5. ActivePower

    Thread Starter Member

    Mar 15, 2012
    155
    23
    The same thing happened once more today. Maybe it is a bug in the programmer software (WinPicProg), it did not show any code memory bits to begin with when I had just loaded the code yesterday. :confused:
    Also, to add to my woes, after I rebuilt the circuit even the LED isn't flashing anymore!
     
  6. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,131
    267
    I humbly recommend that you replace the PIC even if it *worked again*

    As you will learn, there are so many things to consider when developing embedded code, the last thing you need is the possibility that the chip has been damaged in some subtle way that causes you to tear your hair out for days trying to find a "bug" that isn't really there. Your time and sanity are worth more than $2.50 for a new chip.
     
Loading...