![Microchip Technology MPLAB PICkit 4 User Manual Download Page 37](http://html1.mh-extra.com/html/microchip-technology/mplab-pickit-4/mplab-pickit-4_user-manual_1785690037.webp)
When using a 16-bit device, an unexpected Reset occurred. How do I determine what caused it?
Some things to consider:
• To determine a Reset source, check the RCON register.
• Handle traps/interrupts in an Interrupt Service Routine (ISR). You should include
trap.c
style code, for
example,
void __attribute__((__interrupt__)) _OscillatorFail(void);
:
void __attribute__((__interrupt__)) _AltOscillatorFail(void);
:
void __attribute__((__interrupt__)) _OscillatorFail(void)
{
INTCON1bits.OSCFAIL = 0; //Clear the trap flag
while (1);
}
:
void __attribute__((__interrupt__)) _AltOscillatorFail(void)
{
INTCON1bits.OSCFAIL = 0;
while (1);
}
:
• Use ASSERTs. For example:
ASSERT (IPL==7)
Frequently Asked Questions
©
2020 Microchip Technology Inc.
User Guide
DS50002751D-page 37