I found similar questions on the internet. some answered that all resets re-initialize the SFR. I don't know if this was tested or concluded. I'm so confused because at http://microchip.wikidot.com/8bit:mclr they state that:
When an external MCLR reset occurs, the program counter will be reset to the top of the program execution or memory location 0x00 which is the start of all program memory. MCLR resets will not re-initialize all internal functions like a Power On Reset (POR) or Brown-Out Reset (BOR) style reset. It can be considered a hardware means to activate a software reset.
Also in microchip slides (RESET causes and effects) http://ww1.microchip.com/downloads/en/DeviceDoc/reset.pdf
An MCLR reset will not change the state of any general purpose RAM locations, but some of the special function registers will be initialized. This applies to most types of reset, and the initialized state of the special function registers are specified in the applicable data sheet.
In the datasheet, (pic18f45k22) the legend found under the description of the SFR states that the initialization values are after a POR. look for example at TRISA register.
-n = Value at POR
Why did they state that it's "Value at POR" not "Value at any Reset" on the other hand, some registers such as the OSCCON2 define 2 initialization states.
-n/n = Value at POR and BOR/Value at all other Resets
also in the same datasheet section 4.7 Reset state of registers:
Some registers are unaffected by a Reset. Their status is unknown on POR and unchanged by all other Resets. All other registers are forced to a “Reset state” depending on the type of Reset that occurred.
What does that mean!?
also in the same dataheet:
Table 5-2 describes the Reset states for all of the Special Function Registers. The table identifies differences between Power-On Reset (POR)/Brown-Out Reset (BOR) and all other Resets, (i.e., Master Clear, WDT Resets, STKFUL, STKUNF, etc.). Additionally, the table identifies register bits that are changed when the device receives a wake-up from WDT or other interrupts.
Well, table 5-2 has only the "values at POR/BOR". How can I know the value at other resets!? I find this confusing. So are all SFR initialized to the values in the table after any reset... For example, will an MCLR reset cause the TRISA register to initialize to 0xFF or will it remain unchanged?
Thanks a lot