James Humes wrote: > Are there any suggestions for fixing this in a way other than my > insertion of NOPs method? Yes. Your method got you into trouble because it tried to do a dumb edit on the HEX file instead of interpreting it properly, making modifications, then writing it back out. There are many legal ways the HEX file can be written that can be different at the low level syntax. Another point is that it would be best to put RETLW h'FF' in the source code with an appropriate comment what the value means and that it will be filled in during production test. That would also give you the option of modifying the value in place after the programming step in case that is more convenient. I use this method for a current customer. The firmware is first programmed into the device because it needs to run in order to collect the data for calibration. Once the data is collected, the FFh is overwritten with the computed value without reprogramming the device. You can always flip 1 bits to 0 but going the other way requires an erase operation, often on more than a single memory location. The source code specifies FFh because that is the erased state. If you can determine calibration values up front, then making a temporary custom HEX file will be the fastest way to get there since only a single programming operation is required. This should be done by actually reading the HEX file properly according to the spec, changing selected values, then writing out a new HEX file with the custom values. If you don't properly read the HEX file, you'll probably have this problem again some time in the future even if you manage to kludge around it now. Reading a HEX file is easy. Doing it right in the first place would probably have taken less time that you already spent finding and thinking about this issue 7 years later. Don't make the same mistake again. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist