LAPIS Semiconductor ML62Q1000 Series User Manual page 246

Table of Contents

Advertisement

5.3.6.2 Description of Interrupt Function to Enable Multiple Interrupts
When describing an interrupt function to enable multiple interrupts, specify "2" in the category field in INTERRUPT
pragma and SWI pragma. Even if it is not specified in the category field, multiple interrupt are enabled. Built-in
function_EI can be called in an interrupt function to enable multiple interrupts.
Example of description
static void intr_fn_20 (void);
volatile unsigned short TM2msec;
#pragma interrupt intr_fn_20 0x20 2
static void intr_fn_20 (void)
{
_EI( );
TM2msec++;
_DI( );
CIL = 0;
}
If described as in the example, intr_fn_20 ( ) is handled as an interrupt processing function to enable multiple interrupts.
CCU8 outputs the assembly code as shown below.
Example of output
_intr_fn_20
push
push
;;
ei
;;
l
add
st
;;
di
;;}
;;
mov
st
;;}
pop
pop
In an interrupt function to enable multiple interrupts, ELR and EPSW are saved in the stack so that they should not be
destroyed by multiple interrupts. This is the difference from the interrupt function to disable multiple interrupts. To
return from the interrupt function, "POP PSW, PC" is used instead of "RTI".
FEUL62Q1000
/*Enable multiple interrupts*/
/*Disable multiple interrupts*/
/*Clear the highest current interrupt request level*/
:
elr,
epsw
er0
_EI( );
/*Enable multiple interrupts*/
TM1msec++;
er0,
NEAR _TM2msec
er0,
#1
er0,
NEAR _TM2msec
_DI( );
/*Disable multiple interrupts*/
CIL = 0;
r0,
#00h
r0,
0f022h
er0
psw,
pc
ML62Q1000 Series User's Manual
Chapter 5 Interrupts
5-50

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents