Hi,
The PIC is probably resetting or locking up due to the EMI/EMF caused by the high speed/high current signals thru the coil and wiring.

I'd clean up the wiring, keeping the high current stuff as far away from the low level stuff as possible. Make sure the coil current has a "clear return path" back to the 36V supply so that it doesn't need to pass thru any of the low level ground path. If they share the same ground (which they seem to) make sure to keep them separated thru out the circuit and only connect them together at one single point. Make sire you have ample decoupling across the supply for the PIC right across the supply pins, not inches away from it.

You may want to put a low(ish) value resistor in the gate path for the MOSFET, (10 to 100ohms perhaps) it'll slow down the turn on/turn off slightly, reducing the EMI.

Make sure you have proper decoupling at the MOSFET driver, datasheet suggests 4.7uF and 100nF - again, right at the supply pins of the device.

Finally, that 7812 regulator won't work properly when driven from a 12V supply. If the supply is indeed 12VDC then I'd skip the regulator.