How to check whether the microcontroller is getting reset?