8.7 Design Tips
Question 1: An algorithm does not give the correct results.
Answer 1:
Assuming that the algorithm is correct and that interrupts are enabled during the algorithm,
ensure that are registers that are used by the algorithm and by the interrupt service routine are
saved and restored. If not some registers may be corrupted by the execution of the ISR.
Question 2: My system seems to lock up.
Answer 2:
If interrupts are being used, ensure that the interrupt flag is cleared after servicing that interrupt
(but before executing the RETFIE instruction). If the interrupt flag remains set when the RETFIE
instruction is executed, program execution immediately returns to the interrupt vector, since there
is an outstanding enabled interrup