How Do I Determine The Cause Of Reset On Mid-range Parts?

The TO and PD bits in the STATUS register allow you to determine the cause of a Reset. However, these bits are quickly overwritten by the runtime startup code that is executed before main(); see Runtime Startup Code for more information. You can have the STATUS register saved into a location that is later accessible from C code, so that the cause of Reset can be determined by the application after it is running again (see Status Register Preservation).