# microchip pic18f: What is the difference between a POR/BOR and other resets

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.

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

• I find that hoping to use each different type of reset condition is a path to madness. Try and select just two reset conditions you want to support and determine what causes and effects set them apart and use those to advantage. Have your code assume nothing and time permitting do a full housekeep no matter what the source of reset has been. – KalleMP Sep 5 '15 at 18:38
• I'm with you. I was just worried that is there any Register that is initialized differently when a RESET other than a POR occurs. for example, after a POR, the TXEN of the USART module is 0 and hence you don't need to disable it if you want to use the associated pin as a digital IO. but what if this was initialized differently after another type of RESET. Then I should clear this bit by software. I know the example is kind of silly and by no way can TXEN be initialized to 1. but when reading " All other registers are forced to a “Reset state” depending on the type of Reset that occurred."... – fhlb Sep 7 '15 at 8:43

The information is there, but the datasheet does a poor job of explaining it. For example, TRISA has this:-

Above each bit name the -1 (described as -n in the legend) means that bit will be a 1 at power on. No separate values are shown for other resets - so we must assume that they are the same...

Looking at LATA we have this:-

The -x/u means indeterminate ('x') at power on, and unchanged ('u') on other resets. But the legend is deficient because it doesn't tell us what 'u' means.

Table 5-2 only shows the values for Power On and Brown Out Reset, so clearly the statement that it "identifies differences between POR/BOR and all other Resets..." is wrong. Also RCON and STKPTR values are not the same for both POR and BOR.

Datasheets for older PICs have clearer descriptions of the reset conditions. For example, here is PORTA on the 18F452:-

• Thanks a lot the table from pic18f452 datasheet makes it clear why did microchip use the phrase " The table identifies differences between Power-On Reset (POR)/Brown-Out Reset (BOR) and all other Resets". It's a matter of copy/paste. I thought that I was misreading something. I guess I can assume what you have said; when not clearly stated, we can assume the reset state is the same. – fhlb Sep 7 '15 at 8:35