Hi,
although i was into programming C51 the reasons for these crashes are basicly the same.
If you have a printed circuit board you should use groundplanes to reduce the impedance of ground connections. Make all connections on the board and all external connections as short as possible. Introduce ferrit beads to external connections and capacitors to ground. So energetic pulses as they appear when switching on a AC motor or any other device will not be introduced to your circuit. If you have not put your circuit put into a metal box, the whole is even more sensitive to electric pulses.
And very important, (you wrote you have measured on the circuit with a oscilloscope) use as few cable connections to the other devices as possible. The are antennas for high frequencies and will introduce additional spikes to your circuit.
If you use a reset circuit with a pin for external reset, make shure no disturbances are introduces via this pin.
In the end, here is a technical Info of Mitsubishi Electric called "Noise suppression technology for microcomputers", seems to be older but never the less quite actuel in tips of how to keep interferences away from µC.
hope it helps,
aoxomox