8-bit Reset Options

8-Bit Reset Options: When a PIC® MCU is first powered up, it will run through some defined hardware functions internally to prepare the MCU 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 initiate 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 the 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.

A block diagram showing the reset structure is below:

reset.jpg

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

pcon.png

Bit 7 - STKOVF: Stack Overflow Flag Bit
1 = A Stack Overflow occured
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

status.png

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 occured during normal operation.

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

resetbits.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.