User manual

Frequently Asked Questions (FAQs)
© 2008 Microchip Technology Inc. DS51766A-page 51
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, i.e.,
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.
I have finished debugging my code. Now I’ve programmed my part, but it
won’t run. What’s wrong?
Some things to consider are:
- Have you selected the debugger as a programmer and then tried to program a
header board? A header board contains an -ICE/-ICD version of the device and
may not function like the actual device. Only program regular devices with the
debugger as a programmer. Regular devices include devices that have on-board
ICE/ICD circuitry, but are not the special -ICE/-ICD devices found on header
boards.
- Have you selected the debugger as a debugger and then tried to program a pro-
duction device? Programming a device when the debugger is a debugger will pro-
gram a debug executive into program memory and set up other device features
for debug (see Section 2.7.1 “Sequence of Operations Leading to Debug-
ging”). To program final (release) code, select the debugger as a programmer.
- Have you selected “Release” from the Build Configuration drop-down list or Proj-
ect menu? You must do this for final (release) code. Rebuild your project, repro-
gram the device, and try to run your code again.
I didn’t set a software breakpoint, yet I have one in my code. What’s going
on?
What you are seeing is a phantom breakpoint. Occasionally, a breakpoint can
become enabled when it shouldn’t be. Simply disable or delete the breakpoint.