While learning PIC programming I suddenly encounter the problem that the programmed information from the .hex files gets corrupted after a while. After reprogramming everything works fine but after a while it looks as if the EEPROM of the PIC gets corrupted. What could be the cause. I have no clue where to look.

The power supply of the PIC is a lab supply at 5V DC. The power lines on the experimental print have 2 capacitors. 1 220uF over the power and one capacitor of 0.1 uF directly over the supply terminals of the PIC.

I am working on a four digit timer. the timer pics up the required preset information from the EEPROM before the counting starts and puts the information in 4 display registers. These registers are scanned by the interupt routine. The counting cycle works fine. But when I want to select a new preset value. The EEPROM returns a non existing value. Verification of the PIC in the programmer indicates that that the the programming is no longer identical to the information in the hex.

The error must be in writing to the EEPROM. Since the overwritten positions in the EEPROM are not always the same I suspect that I have to look for an error just prior to the actual writing cycle. So back to the debugging.

  • \$\begingroup\$ Is the read-back voltage exactly the same as the programming rail voltage during writes? (I'm not sure if there is an internal voltage converter used inside your PIC for programming -- do you know, if so?) Also, I now remember having some trouble programming EEPROM on PIC controllers. But the reason, my vague memory barely recalls, had something to do with not carefully reading all the docs including the errata. Once I'd done that, I remember inserting a single NOP to add an additional cycle of delay and that everything worked perfectly after that. I suspect this may be the issue here. \$\endgroup\$ – jonk Dec 27 '16 at 20:15
  • \$\begingroup\$ I can't find a datasheet for the PIC16F634A. You have a link at Microchip for that? \$\endgroup\$ – jonk Dec 27 '16 at 20:30
  • \$\begingroup\$ I am using the PIC 16F648A. Have also added some more info in the question. I dont mind to start reading again and will do so. But maybe someone has an idea \$\endgroup\$ – Decapod Dec 27 '16 at 20:36
  • \$\begingroup\$ I still can't find the datasheet, though. Perhaps I'm just clueless. Can you provide a link? \$\endgroup\$ – jonk Dec 27 '16 at 20:38
  • \$\begingroup\$ Excusses. I made a mistake with the PIC number \$\endgroup\$ – Decapod Dec 27 '16 at 20:39

Your Answer


Browse other questions tagged or ask your own question.