CHAPTER 6. INTERRUPT FUNCTIONS

6.6INTERRUPT APPLICATIONS

When the interrupt function is used, the following setting are first carried out in the main program.

The interrupt enable flag corresponding to the interrupt to be used is set to “1” (EI IE××× instruction).

If INT0 is used, the active edge is selected (IM0 setting).

The interrupt master enable flag (IME) is set to “1” (EI instruction). Return from the interrupt service program is by means of an RETI instruction.

(1) Interrupt enabling/disabling

<Main Program>

Reset

EI IE0

EI IECSI

EI

DI IE0

DI

Interrupts disabled

INT0 & INTCSI enabled

INTCSI enabled

Interrupts disabled

All interrupts disabled by RESET input.

Interrupt enable flag set by EI IE××× instruction. At this stage, all interrupts are still disabled.

Interrupt master enable flag set by EI instruction.

At this stage, INT0 & INTCSI are enabled.

4Interrupt enable flag cleared by DI IE××× instruction; INT0 disabled.

All interrupts disabled by DI instruction.

137

Page 148
Image 148
NEC PD75P402, PD75402A user manual Interrupt Functions Interrupt Applications, Interrupt enabling/disabling, EI Iecsi