I beleive the problem has something to do with the I/O pins, like the previous user said.
Use pull up resistors or unused input pins.
Make sure no special features are turned on like, analog to digital converters, EUARTs, voltage detectors, etc... and if they are and are not needed turn them off. If they are needed make sure all interrupts associated with them are working properly or turned off. Also, make sure there isn't any type of confuration settings enabled for brown out reset, low voltage reset, watch dog timer, there's quite a few things that can cause this.
One thing that stands out to me is you mentioning it worked fine on the bench. Try to isolate signal inputs with optocoupling. I doubt the engines electrical frequency is affecting the chip, but I suppose it is possible.
Sincerely,
Jesse Randall
Electronics Engineer
**broken link removed**