433
CHAPTER 16 INTERRUPT FUNCTIONS
(11) Do not clear the macro service counter (MSC) to 00H in the data differential mode and data differential mode (with
memory pointer).
(12) Initialize the “value immediately before” (with dummy data) in advance in the data differential mode and data
differential mode (with memory pointer).
(13) Only a 16-bit SFR can be specified by the SFR pointer (SFR.PTR) in the data differential mode and data differential
mode (with memory pointer).
(14) When an interrupt related register is polled using a BF instruction, etc., the branch destination of that BR instruction,
etc., should not be that instruction. If a program is written in which a branch is made to that instruction itself, all
interrupts and macro service requests will be held pending until a condition whereby a branch is not made by that
instruction arises.
Bad Example
LOOP:
BF PIC0.7, $LOOP
All interrupts and macro service requests are held pending until PIC0.7 is
1.
¨
Interrupts and macro service requests are not processed until after exe-
cution of the instruction following the BF instruction.
¥ ¥ ¥
Good Example (1)
.
LOOP:
NOP
BF PIC0.7, $LOOP
¨
Interrupts and macro service requests are serviced after execution of the
NOP instruction, so that interrupts are never held pending for a long period.
Good Example (2)
.
LOOP:
BT PIC0.7, $NEXT
Using a BTCLR instruction instead of a BT instruction has the advantage
that the flag is cleared (0) automatically.
¨
Interrupts and macro service requests are serviced after execution of the
BR instruction, so that interrupts are never held pending for a long period.
BR $LOOP
NEXT:
(15) For a similar reason to that given in (14), if problems are caused by a long pending period for interrupts and macro
service when instructions to which the above applies are used in succession, a time at which interrupts and macro
service requests can be acknowledged should be provided by inserting an NOP instruction, etc., in the series of
instructions.
.
.
.
.