I have had port pins actually toggle their state from high to low, inputs to outputs, outputs to inputs and disable the HPWM because of spikes generated from a small hobby motor. NO, additional power conditioning did not help as the motor was completely isolated with it's own battery supply. All the PIC did was activate a relay. However, the PIC was only 1/2 inch from the case of the motor. Seems my problems went away by making all unused ports output low & leave them floating. I also repeated the tris command repeatedly in case a spike toggels it into an input to prevent a floating input situation.