LAPIS Semiconductor ML62Q1000 Series User Manual page 240

Table of Contents

Advertisement

A-2-2: When multiple interrupts are enabled
• When the script is written in the assembly language
• Processing immediately after the start of interrupt routine execution
Specify "PUSH LR, ELR, EPSW, LR" to save the interrupt return address, the subroutine return address,
and the EPSW1 status in the stack.
• Processing at the end of interrupt routine execution
Specify "POP PSW, PC, LR", instead of the RTI instruction, to return the saved data of the interrupt return
address to PC, the saved data of EPSW1 to PSW, and the saved data of LR to LR.
• When the script is written in C
Define the interrupt routine using the INTERRUPT pragma. Specify "2" in the category field. In this way,
appropriate codes are produced through the C compiler (CCU8).
Example of description:
Status A-2-2
For assembly language:
Intrpt_A-2-2;
PUSH ELR, EPSW, LR
:
EI
:
:
:
BL Sub_1
:
POP PSW, PC, LR
For C language:
static void Intrpt_A_2_2(void);
#pragma interrupt Intrpt_A_2_2 0x22 2
static void Intrpt_A_2_2(void)
{
:
_EI();
:
Sub_1();
:
}
FEUL62Q1000
; Start
; Save ELR, EPSW, and LR at
the beginning
; Enable interrupt
; Call subroutine Sub_1
; Return PC from the stack
; Return PSW from the stack
; Return LR from the stack
; End of interrupt routine
/* Enable interrupt */
/* Call subroutine Sub_1 */
/* End of interrupt routine */
ML62Q1000 Series User's Manual
Chapter 5 Interrupts
Sub_1;
;
DI
; Disable interrupt
:
:
EI
; Enable interrupt
RT
; Return PC from LR
; End of subroutine
void Sub_1(void)
{
_DI();
/* Disable interrupt */
:
_EI();
/* Enable interrupt */
}
/* End of subroutine */
5-44

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents