The -mresetbits
option (see Resetbits Option) preserves some of the
bits in the STATUS register before they are clobbered by the remainder of the runtime
startup code. The state of these bits can be examined after recovering from a Reset
condition to determine the cause of the Reset. This option is not available when compiling
for PIC18 devices.
The entire STATUS register is saved to an assembly variable
___resetbits
. The compiler also defines the assembly symbols
___powerdown
and ___timeout
to represent the bit
address of the Power-down and Time-out bits within the STATUS register and can be used if
required.
These locations can be accessed from C code once
<xc.h>
has been included, noting that the equivalent C
identifiers will use just two leading underscore characters, e.g.
__resetbits
. See Equivalent Assembly Symbols for more details of symbol
mapping.
The compiler will detect the usage of the above symbols in your code and
automatically enable the -mresetbits
option, if they are present. You may
choose to enable this feature manually, if desired.