398
CHAPTER 14 DTP/EXTERNAL INTERRUPT CIRCUIT
s Sample Program for the DTP Function
r Processing
The H level of the signal input to the INT0 pin is detected, and channel 0 of the extended
intelligent I/O service (EI2OS) is activated.
Data is output from RAM to port 0 by DTP processing (El2OS).
r Coding example
ICR07 EQU
0000B7H
;Interrupt control register for the DTP/
external interrupt circuit
DDR0
EQU
000010H
;Port 0 direction register
DDR1
EQU
000011H
;Port 1 direction register
ENIR
EQU
000030H
;DTP/interrupt enable register
EIRR
EQU
000031H
;DTP/interrupt cause register
ELVRL EQU
000032H
;Request level setting register
ELVRH EQU
000033H
;Request level setting register
ER0
EQU
EIRR:0
;INT0 interrupt flag bit
EN0
EQU
ENIR:0
;INT0 interrupt enable bit
BAPL
EQU
000100H
;Buffer address pointer, lower
BAPM
EQU
000101H
;Buffer address pointer, middle
BAPH
EQU
000102H
;Buffer address pointer, upper
ISCS
EQU
000103H
;EI
OS status register
IOAL
EQU
000104H
;I/O address register, lower
IOAH
EQU
000105H
;I/O address register, upper
DCTL
EQU
000106H
;Data counter, lower
DCTH
EQU
000107H
;Data counter, upper
;-------Main program------------------------------------------------
CODE
CSEG
START:
;
:
;Assumes that stack pointer (SP) has
already been initialized.
MOV
I:DDR0,#11111111B;Sets DDR0 as an output port.
MOV
I:DDR5,#00000000B;Sets DDR1 as an input port.
AND
CCR,#0BFH
;Disables interrupts.
MOV
I:ICR07,#08H
;Interrupt level:0 (highest)
;Enables EI2OS.
Channel 0
MOV
BAPL,#00H
;Sets the address of the output data
MOV
BAPM,#06H
;
MOV
BAPH,#00H
;
MOV
ISCS,#12H
;Byte transfer. I/O address fixed.
Buffer address + 1.
Transfer from memory to I/O
MOV
IOAL,#00H
;Address pointer specifies port0(PDR0)as
MOV
IOAH,#00H
the transfer destination.
MOV
DCTL,#0AH
;Number of transfers:
10
MOV
DCTH,#00H
;
CLRB I:EN0
;Disables INT0 using ENIR.
MOV
I:ELVR,#00000001B;Selects H level for INT0.
CLRB I:ER0
;Clears the cause of 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