![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_446.png)
422
CHAPTER 14 DTP/EXTERNAL INTERRUPT CIRCUIT
MB90560 series
14.7 Sample Programs for the DTP/External Interrupt Circuit
This section contains sample programs for the external interrupt function and the DTP
function.
I
Sample program for the external interrupt function
G
Processing
The rising edge of the pulse input to the INT0 pin is detected, and an external interrupt is
generate.
G
Coding example
ICR07
EQU
0000B6H
; Interrupt control register for the DTP/external
; interrupt circuit
; Port 1 direction register
; DTP/interrupt enable register
; DTP/interrupt cause register
; Request level setting register
; Request level setting register
; INT0 interrupt flag bit
; INT0 interrupt enable bit
DDR1
ENIR
EIRR
ELVRL
ELVRH
ER0
EN0
;-------Main program------------------------------------------------------------------------------------------------------
CODE
CSEG
START:
;
:
; Assumes that stack pointer (SP) has already been
; initialized.
MOV
I:DDR1,#00000000B ; Sets DDR1 as an input port.
AND
CCR,#0BFH
; Disables interrupts.
MOV
I:ICR07,#00H
; Interrupt level: 0 (highest). Disables EI
2
OS.
CLRB
EN0
; Disables INT0, using ENIR.
MOV
I:ELVR,#00000010B ; Selects the rising edge for INT0.
CLRB
I:ER0
; Clears the cause for INT0 using EIRR.
SETB
I:EN0
; Enables INT0 using ENIR.
MOV
ILM,#07H
; Sets ILM in PS to level 7.
OR
CCR,#40H
; Enables interrupts.
LOOP:
MOV
A,#00H
; Endless loop
MOV
A,#01H
BRA
LOOP
;-------Interrupt program-------------------------------------------------------------------------------------------------
WARI
CLRB
ERP
; Clears the interrupt request flag.
;
:
;
User processing
;
:
RETI
; Returns from interrupt.
CODE
ENDS
EQU
EQU
EQU
EQU
EQU
EQU
EQU
000011H
000030H
000031H
000032H
000033H
EIRR:0
ENIR:0