Task-Specific Program Code
C-18
Example C–12. Testing and Using Asynchronous Serial Port Delta Interrupts (bitio.asm)
* File:
bitio.asm
*
* Function:
Delta interrupt test code
*
*
Accepts delta interrupt on IO pins 3 and 2
*
*
If bit level changes on bit 7, send character ’c’
*
*
through UART & toggle xf pin.
*
*
If bit level changes on bit 6, send character ’i’
*
*
through UART & toggle xf pin.
*
*
The delta bits are cleared after interrupt service
*
.title ”BIT IO Interrupt Test” ; Title
.copy
”init.h”
; Variable and register declaration
.copy
”vector.h”
; Vector label declaration
.text
start:
clrc
CNF
; Map block B0 to data memory
ldp
#0h
; set DP=0
setc
INTM
; Disable all interrupts
* UART initialization *
splk
#0ffffh,ifr
; clear interrupts
splk
#0000h,60h
out
60h, wsgr
; Set zero wait states
splk
#0c200h,61h
; reset the UART by writing 0
out
61h, aspcr
; 1 stop bit, Delta interrupt,
; input i/o
splk
#0e200h,61h
out
61h,aspcr
splk
#4fffh,62h
out
62h,iosr
; disable auto baud
splk
#0411h, 63h
; set baud rate =1200 @ 20-MHz CLKOUT1
out
63h, brd
splk
#20h,imr
; enable UART interrupt
splk
#0063h,65h
; transmit value = 0063h =’c’
splk
#0069h,67h
; transmit value = 0063h =’i’
mar
*,ar1
lar
ar1,#rxbuf
* Load data at DM300 *
lar
ar1,#rxbuf
lar
ar0, #size
; load buffer size
mar
*,ar1
; load data pointer
clrc
intm
; disable interrupts for polling
wait:
idle
b
wait