Recently I needed to revist the code for a project I did back in 2012 Navigation Lights for Models. In doing so I discovered that the latest version of MPLAB X (5.45) has dropped the old MPASM assembler and the version of assembler now being used doesn’t play well with source code written for the old MPASM assembler. I still have MPLAB X IDE V5.30 installed with support for MPASM and this works fine.
The reason I revisited this project was because over the years many people have contacted me having trouble getting it to work. A common cause is the calibration word in the PIC16F629 getting erased. Even I get caught out with it 🙁
Since the original code attempts to read the calibration word after power-on, if it’s not present the code just loops and the PIC appears to be dead. Since the timing is in no way critical for this application, I have reassembled the original code, skipping the bit that attempts to read the calibration word and instead writing a default 0x7F into the OSCCAL register of the 12F629/675. This way, it doesn’t matter if the calibration word gets erased or overwritten, the program will still happily run.
You can download the programmer ready HEX file for this new version below.
In the screenshot below, the calibration data is invalid, but we program the new code ignoring the warning and it runs just fine.
8 years after the original project was published, I was still able to find the demo board to verify the modified code runs correctly.