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!
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!