I have a nice little system which uses CanBus to Control 8 LED lights on a bespoke PCB.
I am using Darrel Taylors excellent SPWM_Int routines.

I have run this for several weeks now on a LABx2 board with the necesary to control four lights for test purposes.

This evening I got round to setting up the bespoke PCBs and programmed the working code.

The code ran first time, but, via telltale leds on the pcb I noticed the mapping of some lights was not correct.

A quick look at the schematic showed that B0,B1,D7,D6,D5,D4,C5,C4 are lights 1-8 respectively
The original test config is B0,B1,D4,D5,B4,B5,B6,B7

No problem I thought, just redefine the SPWM_Pin entries in the main program appropriately.

The code compiled and assembled without errors, but when I program, it quickly fails with code error at 0900.

I have changed the code back and get the same error, I then compiled back up versions of both my program and the SPWM include file, same error.

I changed the programmer hardware, same error. I tried to compile to the LAbx2 hardware and got the same error , but at 0300...

I checked all the configuration settings against 'program, Read' and the configurations are correct. I can reprogram after Read without error. Of course this is just reloading the original code back to the device.

SO....why does a new compile of 'backup' unadulterated code not program, but read back code does?

Why did it compile the first time, but not subsequently?
Clearly missing something...but what ?

Using Mpasm5.03 and PBP 2.6 Pic 18f4580

9PM brainfade may be at play here. Perhaps a fresh look in the morning.
Any wisdom most welcome.

PS
Quick question for Darrel,
I notice the last line in SPWM_Int.bas is OverSPWM:

There is no code after this and no Return ... appreciate this is an include file, so, is this a neat way to branch out of the include back to the main program? I see the sub is called from within the include....