Hello!

I am using WRITECODE and READCODE at run time in a PIC16F876A. I send in a series of 70 or more words from my PC (none larger than a 14 bit value) and WRITECODE them into upper FlashRAM sequential addresses (not overwriting program memory).

But when I later READCODE the values from memory, some (about 20%) of the values are wrong. The errors do not follow any particular pattern in the memory sequence that I can see.

I know the 14-bit values are being received correctly by the PIC because I send them back out to an LCD for view prior to the WRITECODE instruction. I have confirmed the errors by sending the READCODE values back to the PC and compared them with what was sent.

The PIC16F876A data sheet talks about writing in blocks of 4 words, not crossing page boundaries, and that a write is really an erase-then-write operation, but I thought that PBP took care of all that for WRITECODE and READCODE.

I will be glad to post the code here if needed, but before doing that I need to ask a basic question:

Am I supposed to use ERASECODE before using WRITECODE on a PIC16F876A?

I would appreciate any guidance you can give on this.

Thank you,
Bob Pigford
Newark, Delaware