8-bit PIC® MCU Reset Options

Last modified by Microchip on 2023/11/22 16:31

When a PIC® microcontroller (MCU) is first powered up, it will run through some defined hardware functions internally to prepare for proper operation. This can include the oscillator start-up and power stabilization. The reset structure can control the start-up by delaying certain functions and also initiating others. The start-up procedure will vary with the reset type. Some resets may require a different response for the user code than the typical power-on reset. If the reset is from power loss then a complete restart may be required. If the power dips below a safe level but not a complete power loss, then a different type of brown-out reset handler may be desired. This training page will describe the various options for reset handling.

The 8-bit PIC MCU device can be reset in multiple ways and each device has a different subset of reset options. Here is a list of potential reset options:

Reset Structure Block Diagram

PIC18 MCU Interrupt Block Diagram

Reset Indicator Bits

When a reset occurs, multiple bits in either the STATUS register or the PCON register are updated to indicate the cause of the reset. These can be monitored in software to determine if any kind of reset has occurred. Typically, that test code is placed at the top of the main program loop since any reset will most likely cause that section of code to be implemented.

PCON : Power Control Register

PIC18 Reset Indicator Status Bits

Bit 7 - STKOVF: Stack Overflow Flag Bit
1 = A Stack Overflow occurred
0 = A Stack Overflow did not occur

Bit 6 - STKUNF: Stack Underflow Flag Bit
1 = A Stack Underflow occurred
0 = A Stack Underflow did not occur

Bit 5 - Unimplemented

Bit 4 - RWDT: Watchdog Timer Reset Flag Bit
1 = A Watchdog Timer Reset did not occur
0 = A Watchdog Timer Reset occurred

Bit 3 - RMCLR: MCLR Reset Flag Bit
1 = A MCLR Reset did not occur
0 = A MCLR Reset occurred

Bit 2 - RI: Reset Instruction Flag Bit
1 = A Reset Instruction has not been executed
0 = A Reset Instruction did not occur

Bit 1 - POR: Power-on Reset Status Bit
1 = Power-On Reset did not occur
0 = Power-On Reset occurred

Bit 0 - BOR: Brown-out Reset Status Bit
1 = Brown-Out Reset did not occur
0 = Brown-Our Reset occurred

STATUS : Status Register

PIC18 Status Register

Bit 7 - Unimplemented: Read as ‘0’

Bit 6 - Unimplemented: Read as ‘0’

Bit 5 - Unimplemented: Read as ‘0’

Bit 4 - TO: Time-Out bit
1 = After power-up, CLRWDT instruction or SLEEP instruction
0 = A WDT time-out occurred

Bit 3 -PD: Power-Down bit
1 = After power-up or by the CLRWDT instruction
0 = By execution of the SLEEP instruction

Bit 2 - Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero

Bit 1 - DC: Digit Carry/Digit Borrow bit
1 = A carry-out from the 4th low-order bit of the result occurred
0 = No carry-out from the 4th low-order bit of the result

Bit 0 - C: Carry/Borrow bit
1 = A carry-out from the most significant bit of the result occurred
0 = No carry-out from the most significant bit of the result occurred

Indicator Bits Example

The two register's indicator bits are combined into one chart as seen below.
If the RWDT = 0 and TO = 0 then a Watchdog Timeout Reset occurred during normal operation.

If instead, POR = 0 and TO = 0 then a Watchdog Timeout Reset occurred during sleep mode.

PIC18 Reset Indicator Bits Example

Back to Top