How can I use the TO and PD bits to determine the cause of reset on PIC devices?
Some PIC devices have TO and PD bits in the STATUS register that can be used to
determine the cause of a reset. However the state of these bits are soon overwritten
after the reset has occurred and program execution has resumed.
The --RUNTIME suboption "resetbits" can be used to preserve these bits, and the
entire STATUS register, in variables that can be examined later in your program. If you
are using MPLAB IDE, this option can be specified by enabling the Backup reset
condition flags checkbox in the Linker tab of the Build Options dialog.
For full details of the names and types of the variables used, check your compiler manual
in the section called Status Register Preservation.
--多看看PICC 的FQA,上面有很多有用的信息.
http://www.htsoft.com/support/faqs.php
|