Program Example For Interrupt Handling - Fujitsu MB90420/5 (A) Series Hardware Manual

F2mc-16lx family 16-bit microcontrollers
Table of Contents

Advertisement

MB90420/5 (A) SERIES F

6.9 Program Example for Interrupt Handling

An example for interrupt handling program is shown below.
n Program example for interrupt handling
• Processing specification
This is an example for interrupt handling program using external interrupt 0 (INT0).
• Coding example
DDR1
EQU
ENIR
EQU
EIRR
EQU
ELVR
EQU
ICR00
EQU
STACK
SSEG
RW
STACK_T
RW
STACK
ENDS
; - - - - - Main program - - - - - - - - - - - - - - - - - - - - - - - - -
CODE
CSEG
START:
MOV
MOV
MOV
MOV
MOVW
MOVW
MOV
OR
MOV
MOV
MOV
MOV
:
LOOP:
NOP
NOP
NOP
NOP
BRA
; - - - - - Interrupt program - - - - - - - - - - - - - - - - - - - - - - - -
ED_INT1:
MOV
NOP
NOP
NOP
NOP
NOP
NOP
RETI
CODE
ENDS
; - - - - - Vector setting - - - - - - - - - - - - - - - - - - - - - - - - - - -
VECT
CSEG
ORG
DSL
ORG
DSL
DB
VECT
ENDS
END
2
MC-16LX FAMILY 16-BIT MICROCONTROLLERS HARDWARE MANUAL
; Port 1 direction register
000011
H
; Interrupt/DTP enable register
000030
H
; Interrupt/DTP factor register
000031
H
; Request level setting register
000032
H
; Interrupt control register 00
0000B0
H
; Stack
100
1
;
; The general-purpose register uses the starting bank.
RP,#0
; ILM in PS set to level 7
ILM,#07
H
; System stack set
A,#!STACK_T
SSB,A
; Stack pointer set
A,#STACK_T
; In this case, S flag = 1, so SSP set
SP,A
; The P10/INT0 pin is set to input.
DDR1,#00000000
B
; I flag of CCR in PS set to enable the interrupt
CCR,#40
H
; Interrupt level 0 (highest)
I:ICR00,#00
H
; INT0 as an H level request
I:ELVR,#00000001
B
; INT0 interrupt factor cleared
I:EIRR,#00
H
; INT0 input enabled
I:ENIR,#01
H
; Dummy loop
; Unconditional jump
LOOP
; New acceptance of INT0 disabled
I:EIRR,#00
H
; Return from interrupt
ABS = OFF
H
; Vector set to interrupt #11 (OB
OFFDO
H
ED_INT1
; Reset vector setting
OFFDC
H
START
; Set to single-chip mode
00
H
START
H
6-36
)

Advertisement

Table of Contents
loading

Table of Contents