RPM measurement using interrupt
Your motor is creating back emfs that can cause your circuit to reset. You should, at the minimum, conect a reverse diode across the motor. This is not just standard practise but almost obligatory if you are to avoid damaging the MOSFET. Try adding a few power supply decoupling capacitor on the chips power rails too.

Voltage regulators also need input and output capacitors. If you actually have them fitted but felt that this detail was unimportant to show in your diagram then here begins your learning experience.