Fujitsu MB89950/950A Pager User Manual


 
232
CHAPTER 11 EXTERNAL INTERRUPT CIRCUIT (EDGE)
11.6 Program Example for the External Interrupt Circuit
This section gives a program example for the external interrupt circuit.
Program example for the external interrupt circuit
Processing description
Generates interrupts on detecting a rising edge on pulses input to the INT1 pin.
Coding example
EIC1 EQU 0030H ; External interrupt control register 1
EIR1 EQU EIC1:7 ; Defines the external interrupt request flag bit.
SL10 EQU EIC1:5 ; Defines the edge polarity selection bit.
EIE1 EQU EIC1:4 ; Defines the interrupt request enable bit.
ILR1 EQU 007CH ; Set interrupt level setting register 1.
INT_V DSEG ABS ; [DATA SEGMENT]
ORG 0FFF8H
IRQ1 DW WARI ; Set INT1 interrupt vector.
INT_V ENDS
;-----Main program----------------------------------------------------------------
CSEG ; [CODE SEGMENT]
; Stack pointer (SP) etc. are already initialized.
:
CLRI ; Disable interrupts.
CLRB EIR1 ; Clear interrupt request flag.
MOV ILR1,#11110111B ; Set interrupt level (level 1).
SETB SL10 ; Select rising edge.
SETB EIE1 ; Enable output of interrupt requests.
SETI ; Enable interrupts.
:
;-----Interrupt processing routine------------------------------------------------
WARI CLRB EIE1 ; Clear INT1 interrupt request flag.
PUSHW A
XCHW A,T
PUSHW A
:
User processing
:
POPW A
XCHW A,T
POPW A
RETI
ENDS
;---------------------------------------------------------------------------------
END